|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, June 04, 2012 5:00 PM
Points: 891,
Visits: 225
|
|
|
|
|
|
SSCrazy
      
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
|
|
|
|
|
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 !! 
|
|
|
|
|
Mr 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...
|
|
|
|