October 11, 2012 at 9:11 am
I am wanting to use Transfer SQL Server Objects Task to copy tables and their data from one database to another but the hitch is that where the table is in the dbo schema in the source database but it needs to be on another schema on the destination. I know I can copy them over using the dbo schema and run tsql to update the schema but how do I handle tables that are in schemas on the source that dont exist in the destination? For example [DansSchema].[DansTable] on source database needs to go to [NewSchemaName].[DansTable]. DansSchema doesnt exist on the destination db.
October 11, 2012 at 9:39 am
I've come up with a possible work around. If you have permission to run Exe SQL Task to update the schema on the source to the dbo schema which more than likely will exist on both databases, copy the table over into the dbo schema in the destination, Update the src tables back to original schema, then update the destination to the desired schema in anothe exe sql task.
October 15, 2012 at 4:13 pm
Actually went in this direction. I created the missinig schemas on my destination db, ran the obj transfer, then ran the following to move all tables into the corrrect schema
exec sp_MSforeachtable 'ALTER SCHEMA [Schema to Move To] TRANSFER ?'
Then I dropped the unneeded schemas.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply