ql 2008 - INSERT INTO
Wants to move(copy) data from different DATABASE
Server Name is :WIN-GIGA\SQLEXPRESS
Database names are
1:RUNDATA
2:BAKDATA
And in both the DATABASE ONE TABLE is common ie. Product
now i wants to copy the content of table from 'RUNDATA\Product' TO BAKDATA\Product
SELECT * INTO BAKDATA.dbo.product FROM RUNDATA.dbo.product;
If the table already exists - and that table already has data, it becomes a bit more involved. You have to use an INSERT statement - and check for existence to only insert new rows. If you need to UPDATE existing rows - then you need to perform an INSERT and then and UPDATE - or preferably a MERGE.