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 2012 Forums
 Transact-SQL (2012)
 move data from database to other database

Author  Topic 

samir.first
Starting Member

34 Posts

Posted - 2013-10-01 : 16:42:18
i need move data from database to other database
DB1
Table1
ID Name
2562 samir
2563 john
DB2
Table1
ID name
1 samir
2 john
and Table1 Relation For other More Tables
I need Query Change ID in Other Tables

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2013-10-02 : 08:08:37
if the ID is an identity, you could use IDENTITY_INSERT.
Also, try looking at the MERGE statement.

You are not clear with your requirements. Are there any business rules that you need to follow, or just overwrite DB2 table with data in DB1 table?








How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2013-10-03 : 04:59:21
try using SQL Server Import and Export Wizard
Go to Top of Page

kdeutsch
Yak Posting Veteran

83 Posts

Posted - 2013-10-03 : 14:45:00
Without knowing more information and if you are just moving data from one table to another.
1. Delete other table
2. then recreate with Select * into (RECREATE TABLE) from Old table
Go to Top of Page
   

- Advertisement -