pkr2606
asked on
T-sql to change schema of all tables
I have a table in which there are fields like
Schema
Name of table
Create_date
Modify_date
Action
Owner
I would like to change schema of all the tables into one particular schema..i need a t-sql to change as there are many tables
Schema
Name of table
Create_date
Modify_date
Action
Owner
I would like to change schema of all the tables into one particular schema..i need a t-sql to change as there are many tables
ASKER
HI, first I need to crate a copy of all tables and then delete. Instead of updating can you tell me to copy tables to different schema in a loop.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Additional IMPORTANT NOTE: Please ensure that you have scripted all the permission of original object before transferring to new schema because permissions granted to original object e.g. dbo.testTable will be removed during transfer.
UPDATE tableName set [Schema] = 'newSchemaName'