|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Sunday, June 12, 2011 5:00 PM
Points: 195,
Visits: 80
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, October 08, 2012 10:52 AM
Points: 2,
Visits: 6
|
|
Can someone tell me how to rename all DEV tables and it's indexes to LIVE nomenclature? Ex: ProductsDev to ProductsLive and all indexes renamed to Live extension as well.
Here is a query selecting what DEV tables and their indexes. I just need to put it in a loop for rename. Doing so keeps naming conventions correct and makes a generic method so if indexes are added sql code doesn't have to be maintained.
Any help is greatly appreciated.
/* Loop through all DEV tables and it's indexes */ SELECT b.name 'Table', a.name 'Index' FROM sysindexes a, sysobjects b WHERE a.id = b.id and b.name like '%Dev' and (a.name like 'PK%' or a.name like 'IX%') and b.type = 'U' and indid NOT IN (0, 255) order by a.name
|
|
|
|