Thinking outside the box

Patron Saint of Lost Yaks
posts - 203, comments - 734, trackbacks - 4

My Links

Advertisement

News

Archives

Post Categories

Change schema for all tables

I just helped a guy here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=98346 with schema
and thought that someone could benefit from this code

exec

 

 

sp_MSforeachtable "PRINT '? modify'; ALTER SCHEMA new_schema TRANSFER ?; IF @@ERROR = 0 PRINT '? modified'; PRINT ''"

Print | posted on Wednesday, March 05, 2008 1:31 AM | Filed Under [ SQL Server 2008 Administration SQL Server 2005 ]

Feedback

Gravatar

# re: Change schema for all tables

This little piece of code has helped me so many times! Thanks for sharing!
5/27/2012 10:12 AM | Chris
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET