Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 How MERGE few databases to one

Author  Topic 

anxcomp
Starting Member

41 Posts

Posted - 2007-11-12 : 10:42:16
Hi All,

I have to merge few different databases to one big common database :) I mean about structure (tables, procedures, users, roles etc.) and data. May you suggest, help me how I should do this. How start? Create brand new database or relay on one old and add difference from other?

--
Regards,
anxcomp

anonymous1
Posting Yak Master

185 Posts

Posted - 2007-11-12 : 10:52:30
if you want to keep the same schema and there are no overlapping object names, you could try to make a new database. inside it run the generated scripts for all objects of each database. then move the data with tsql insert select scripts if the databases are on the same server and the amount of data will not be a problem for the transaction log size limit
Go to Top of Page

anxcomp
Starting Member

41 Posts

Posted - 2007-11-12 : 14:28:34
Yes, databases fortunately are on the same server :) So you suggest make new database, but I'm not sure is this good way do this manually. Databases contains a lot of objects tables, procedures, users...

Do you have any idea how simplify this process and final have working one database ?

--
Regards,
anxcomp
Go to Top of Page

anonymous1
Posting Yak Master

185 Posts

Posted - 2007-11-12 : 14:37:14
in management studio, right click a database to merge. pick menu "tasks", "generate scripts..." when you get to the "choose script options" form, look those over carefully to ensure you get the intended results. the resulting script can be used to build the desired objects in the new database.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-12 : 22:34:49
You can copy db objects between dbs with ssis package. But any reason to do that?
Go to Top of Page
   

- Advertisement -