Reputation: 758
I recently upsized my MS-Access database to SQL Server and in the process successfully exported a bunch of tables.
However, now the imported tables are prefixed with MSH-CHAMBERS\mfanimpela
which I assume is my username and this is the schema (or owner property).
While I have seen posts on changing EACH table schema to the desired 'dbo', I want a statement that can help me change ALL of my tables (since these are so many).
Please help - chagbert.
Upvotes: 0
Views: 989
Reputation: 560
Use the sp_MSForEachTable procedure like this:
EXEC **sp_MSForEachTable** 'ALTER SCHEMA dbo TRANSFER ?'
-- in the above example dbo is the targeted schema where you want to place your tables
Upvotes: 1
Reputation: 1514
Google sp_MSForEachTable
and use it to call sp_rename
You might need to do additional checks before you rename the table to avoid mistakes.
Upvotes: 0