Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Changing Primary key names to standard naming convention across the DB

By Vidyadhar Pandekar,

  1. Copy the script into Query window
  2. Select the appropriate database
  3. Select Query Result to Text from the Query Menu
  4. Execute the script
  5. Copy the result/ output script in the query window
  6. Select the same database
  7. Execute the script
  8. Validate the primary key names changed.

*Note-

PK_TableName is considered as standard primary key notation

Script works even if PK is referred by FK.

Total article views: 1660 | Views in the last 30 days: 2
 
Related Articles
SCRIPT

Transpose Query Output

script to return query result transposed.

BLOG

A Script A Day - Day 7 - Memory Queries

Today's script is a collection of a few memory queries I've collected from various sources over the ...

FORUM

Scripting help - Need a query to find filenames and filepaths under a certain directory

Scripting help - Need a query to find filenames and filepaths under a certain directory

FORUM

VS2008 - just query scripts?

Can I run Alter Table script from VS2008?

 
Contribute