views:

49

answers:

2

Hi

I have a Databse "Product" in in sql 2008.I have another Databse "ORDER" in sql 2008. Both exist in different servers.

Now the requirement is to Merge both databases, and test pointing the applications to this new DB.

Can anyone suggest the best way to accomplish this without losing the information?

I have 2 options.

1) Script the DB objects.(script both the DB and run this scripts inthe new DB)

2) Export DB

Which one in this is best or should i use any other methods to avoid errors.

I am new to SQL so please guide me with correct options.

Thanks

SNA

A: 

Hello there Swapna,

In my opinion the best way to achieve what you want is by just Exporting the database. I think this is the best option because it's alot more safe then scripting the db's into a new one (a way to just get alot of frustration and errors). Just try the exporting of your database first before trying to do anything with scripting (which obviously also takes alot more time). So try your fast solution first, and see if it will work.

(I see you are using sql-server 2008) Are you also using the management studio? If so, you can go into the tables in edit-mode and try to copy / paste rows into the new tables. I don't know how big your tables / DB's are, but this could also be an option.

Greetings,

Younes

Younes
A: 

As you say, two options are scripting or using the SQL server export/import wizard.

I've used both (for the same database as it happens)

A third option is to use Visual StudioTeam System 2008 Database Edition GDR.

In terms of a one time export and import then I'd recommend going with the wizard. This is very safe and also very straightforward. Particulary as you are new to SQL server, you want to take the approach that minimizes the risk.

The only downside to doing it this way is that it is perhaps a little less transparent than the other methods.

On the project where I merged databases I ended up using the scripting method but that was mainly because I had a project that was already using GDR to merge incremental database updates, so adding in a data merge script to that was a simple task - all changes needed to go through DBAs who unfortunately weren't very SQL literate (I know!) so keeping all the processes similar was a must.

I also took some of my learnings from scripting the data and applied them to setting up my reference data scripts, so the effort of scripting was not a one time cost.

Either way, the most important tip I can give is to back up the databases before doing any work on them.

David Hall