Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 1638 | Views in the last 30 days: 1
 
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

VS2008 - just query scripts?

Can I run Alter Table script from VS2008?

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

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones