Unanswered: Copy objects from one schema to another schema
I am new to Sql server. I am using sql server 2008 R2.
I want to copy all the objects of one schema and put it in another schema. I want to do that from command prompt.
In oracle we can export the objects of one user and import to another user using exp and imp. I want similar type.
Can anyone suggest me a way to do this?
In SQL Server, you can move objects from one schema to another with the system procedure sp_changeobjectowner. To copy them, you can generate a script of the objects from SQL Server Management Studio, and do a search and replace of the schema name on the resulting text file. This may of course catch references to objects inside view and/or stored procedure definitions.
There may be options for that in the Visual Studio 2010 database synchronization tools, but I do not use VS 2010 at all. Once a set of options has been saved, it can run on a scheduled basis (I imagine as a script, but again, I could be wrong). Check to see if any of your developers have it installed.