views:

20

answers:

2

I want a query to insert records from one table to another table in different database if the destination table already exists, it should append the records at the end of the table. Please help me. Thanks in advance.

+1  A: 

How about this:

USE TargetDatabase
GO

INSERT INTO dbo.TargetTable(field1, field2, field3)
   SELECT field1, field2, field3
     FROM SourceDatabase.dbo.SourceTable
     WHERE (some condition)
marc_s
A: 
INSERT
INTO    remotedblink.remotedatabase.remoteschema.remotetable
SELECT  *
FROM    mytable

There is no such thing as "the end of the table" in relational databases.

Quassnoi