Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all.,

i have a problem with sql server.

I want to transfer TABLE_1 data of DATABSE_1 from to DATABASE_2 in TABLE_1. This is i am handling in a server. Which query i have to write transfer data from DATABASE_1 to DATABASE_2..?

help me..

thanks
- JAGADiSH
(Cheers)
Posted
Comments
Bala Selvanayagam 12-Oct-11 9:20am    
DATABASE1 & DATABASE 2, are they under the same SQL server instance (same computer) ?

If not (Seperate computers) are they in the same network (within LAN?) ?...please shed some light on how your SQL server databases are installed ?

Hi try this,

SQL
SET IDENTITY_INSERT DATABASE_2.dbo.TABLE_1 ON
GO

insert into DATABASE_2.dbo.TABLE_1
select * from DATABSE_1.dbo.TABLE_1
GO
SET IDENTITY_INSERT DATABASE_2.dbo.TABLE_1 OFF
GO



Best Regards

Ab Abulubbad
 
Share this answer
 
SQL
SET IDENTITY_INSERT DB2.dbo.TABLE_1 ON
INSERT INTO DB2.dbo.TABLE_1
SELECT * FROM DB1.dbo.TABLE_1
SET IDENTITY_INSERT DB2.dbo.TABLE_1 OFF
GO
 
Share this answer
 
Try this one

SQL
SELECT *
INTO DestinationDB..MyDestinationTable
FROM SourceDB..MySourceTable


Refer this link:

http://www.w3schools.com/sql/sql_select_into.asp[^]
 
Share this answer
 
v2

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