Tuesday, March 20, 2012

Combine two database

I have a two databse say DB1 and DB2 in sql server 2005 developer edition.
Both Databases are completely different in structure(i.e nothing common)
Both Databases contains Important Data.
I want's to combine them into a new database named dbcombined.{provided that data remains intact}.
How can I do That?
Then Also I have to deploy that db in other system what I have to do?

If objects are unique across databases, you may just use DTS (Import/Export Wizard) or SSMS to import one database objects to another database.

But, if there are no real reasons, I would't recommend doing this at all.

|||

No There is nothing Common in Between two DataBase.(i.e no common table,storedprocedure,view )

Data of both DB is very important to me.

So what Can I Do?

|||

bcp, dts, ssis or snapshot replication your choice. any will do.

|||

I see in DAAB connection always remains open.Could In any way I can close the connection explicitly.
I am checking through activity manager

Following is my simple code

string connString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["AdventureWorksDB"].ConnectionString;

SqlDatabase db = new SqlDatabase(connString);

string sqlCommand = "Select EmployeeID, NationalIDNumber, LoginID, Title from HumanResources.Employee";

DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

DataSet dst = db.ExecuteDataSet(dbCommand);

gridEmployees.DataSource = dst.Tables[0].DefaultView;

gridEmployees.DataBind();

No comments:

Post a Comment