Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
iam creating project in that iam maintains two different databases but i need to copy one data base table to another..
Posted

See the below query
insert into Test1.dbo.table_T1(name) 
(select name from Test.dbo.table_T1 ) 

Where Test1 and Test are Two database and both have same table.
I am just fetching data from one table to insert another database table


So format of query is like below
Insert into DatabaseName1.SchemaName.TableName(Column1,Column2)
(Select Column1,Column2 from DatabaseName2.SchemaName.TableName)
 
Share this answer
 
v3
For transferring small amount of data between two databases, you can use queries. But if you need to transfer large amount of data periodically then please use SSIS packages. Please check below URL to know more about SSIS packages.

http://www.mssqltips.com/sqlservertutorial/200/sql-server-integration-services-ssis/[^]

For one time transfer, you may use Import/Export feature of database :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900