Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Changing Primary key names to standard naming convention across the DB Expand / Collapse
Author
Message
Posted Wednesday, February 10, 2010 5:40 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, June 04, 2012 5:00 PM
Points: 891, Visits: 225
Comments posted to this topic are about the item Changing Primary key names to standard naming convention across the DB


Post #863744
Posted Monday, March 01, 2010 2:16 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, April 18, 2013 8:47 PM
Points: 2,073, Visits: 525
This could also be done simply using the INFORMATION_SCHEMA.TABLE_CONSTRAINTS view.

SELECT 'EXEC sp_rename ''[' + c.CONSTRAINT_SCHEMA + '].[' + c.CONSTRAINT_NAME + ']'', ' +
'''PK_' + c.TABLE_NAME + ''', ''OBJECT'' '
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS c
WHERE c.CONSTRAINT_TYPE = 'PRIMARY KEY'
AND c.TABLE_NAME IS NOT NULL
ORDER BY c.TABLE_NAME

Post #874709
Posted Tuesday, March 02, 2010 9:40 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, June 04, 2012 5:00 PM
Points: 891, Visits: 225
Yes !! this query is much simpler !!




Post #875666
Posted Friday, July 29, 2011 8:28 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 595, Visits: 3,895
I don't see the point.... if that's the 'standard' then the DB should have been developed that way to begin with. If the DB has had any code written against it, this will likely break a lot of it.... just saying...
Post #1150995
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse