writing to SQLDB2 from SQLDB1

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
 
B

Bill Edwards

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top