-->

Ads 720 x 90

Rename Schema / Transfer schema


   1: CREATE SCHEMA new_schema 
   2: GO 
   3: -- Now run these queries one by one, copy and paste the result of this in a new window and run it 
   4: SELECT 'ALTER SCHEMA new_schema TRANSFER ' + SCHEMA_NAME(schema_id) + '.' + name 
   5: FROM sys.tables WHERE schema_id = SCHEMA_ID('old_schema'); 
   6:  
   7: SELECT 'ALTER SCHEMA new_schema TRANSFER ' + SCHEMA_NAME(schema_id) + '.' + name 
   8: FROM sys.views 
   9: WHERE schema_id = SCHEMA_ID('old_schema'); 
  10:  
  11: SELECT 'ALTER SCHEMA new_schema TRANSFER ' + SCHEMA_NAME(schema_id) + '.' + name 
  12: FROM sys.procedures 
  13: WHERE schema_id = SCHEMA_ID('old_schema');
  14:  

Related Posts

There is no other posts in this category.

Total Pageviews

Subscribe Our Newsletter