writing to SQLDB2 from SQLDB1

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

Is it possible to do the following:

I have TWO SQL databases that are being synchronized
In SQL1, there is an INVOICES table
In SQL2, there is also an INVOICES table

Is it possible to run a storeprocedure that reads 100 records and the fields
from SQL1.Invoices and writes then to SQL2.invoices?

I have a procedure that looks like this (i have abbreviated it for
simplification)...

INSERT INTO dbo.stblInvoices
(InvoiceID, InvoiceDate)
SELECT InvoiceID, InvoiceDate
FROM dbo.stblInvoices

I would think that I somehow need to change the first line to somehow
indicate the SQL2 database by changing the "dbo" reference. How would I do
this, if possible?
.....INSERT INTO [SQL2 Database].stblInvoices....

Stephen
 
Fully qualified object name = machine name.database name.owner name.object
name
INSERT INTO SQL2.dbo.stblInvoices.....
FROM SQL1.dbo.stblInvoices
 
Back
Top