Recently I have needed to change the schema for all the tables in a Sql Server 2005 database.
Sql Server 2005 provides a T-SQl statement capable to change the schema for a given object called ALTER SCHEMA
You may use the following syntax to change the schema for all the tables in a database. Just change the "new_schema" string with the desired one:
exec sp_MSforeachtable "ALTER SCHEMA new_schema TRANSFER ? PRINT '? modified' "
Sql Server 2005 provides a T-SQl statement capable to change the schema for a given object called ALTER SCHEMA
You may use the following syntax to change the schema for all the tables in a database. Just change the "new_schema" string with the desired one:
exec sp_MSforeachtable "ALTER SCHEMA new_schema TRANSFER ? PRINT '? modified' "
Enjoy the Script!
No comments:
Post a Comment