Sunday, February 19, 2012

copy tables + SPs from one db to another

I have two databases and want to copy tables (with table data) and stored procedures from one database to another.

both databases have the same name (so management studio is not letting me have both up)...

what should I do?

thanks.

What do you mean both databases have the same name? Do both servers have the same name? If both databases have the same name if you try to attach one into the server with a database of the same name you can specify a new name while attaching.

You can generate script to move the schema and stored procedures. The data is where the answers above will make a difference.

|||

Yes they're on the same server. basically i have my db... a friend was working on a db with the same name on his machine and so i am now trying to merge his stuff into mine. (i have his .mdf/.ldf files)

hope that makes sense.

i will only want to take certain tables(with data)/ SP's from his db...not everything..

how can i do it?

thanks

|||

You can use DTS to replace tables on your DB with the one's from your friend's DB. If you have the mdf/ldf files, rename them and attach them on your server. then you can use DTS to transfer objects/data between the 2 db's. IF you need to MERGE, then its a whole different scenario.

|||

what is DTS?

will i be able to transfer the table data too?

|||

DTS = Data Transformation Services. Read up books on line for more info.

No comments:

Post a Comment