Last post Jan 27, 2021 12:07 AM by KathyW
Jan 25, 2021 03:32 AM|maideen5|LINK
I need to pull remote data to local server(In Premises) for
Analyzing report for Management Dashboard
I have used Merge command in Stored Procedure, it works fine in same
instance or same network SQL Server. we have remote server credential
It is also our server.
But how to pull data from remote server.
Pls advice me
It is my Stored Procedure
MERGE [dbo].[tbl_Finance] AS TARGET
USING edgeadv.[dbo].[MOHead] AS SOURCE
ON (TARGET.DocNo = SOURCE.DocNo)
WHEN MATCHED AND
TARGET.DOCNO <> SOURCE.DOCNO OR TARGET.DOCDATE <> SOURCE.DOCDATE OR
TARGET.CATEGORY <> SOURCE.CATEGORY OR TARGET.TYPE <> SOURCE.MOTYPE OR
TARGET.SUBTOTAL <> SOURCE.SUBTOTAL OR TARGET.GSTP<> SOURCE.GST OR
TARGET.GSTR <> SOURCE.GSTAMT OR TARGET.GROSS <> SOURCE.TOTALGROSS OR
TARGET.NETTTOTAL <> SOURCE.NETTTOTAL OR TARGET.TAX <> SOURCE.GSTAMT
TARGET.DOCNO = SOURCE.DOCNO , TARGET.DOCDATE = SOURCE.DOCDATE ,
TARGET.CATEGORY = SOURCE.CATEGORY , TARGET.TYPE = SOURCE.MOTYPE ,
TARGET.SUBTOTAL = SOURCE.SUBTOTAL , TARGET.GSTP = SOURCE.GST ,
TARGET.GSTR = SOURCE.GSTAMT, TARGET.GROSS = SOURCE.TOTALGROSS ,
TARGET.NETTTOTAL = SOURCE.NETTTOTAL, TARGET.TAX = SOURCE.GSTAMT
WHEN NOT MATCHED BY TARGET THEN
(DocNo, DocDate, Category, Type, SubTotal, GSTP, GSTR, Gross, Tax, NettTotal)
(SOURCE.DocNo, SOURCE.DocDate, SOURCE.Category, SOURCE.MOType, SOURCE.SubTotal,
SOURCE.GST, SOURCE.GSTAMT, SOURCE.TOTALGross, SOURCE.GSTAMT, SOURCE.NettTotal )
Jan 27, 2021 12:07 AM|KathyW|LINK
"But there will be situations in which you need to connect to a remote database that is located in a different instance in the same server
or in a different physical server, and process its data in parallel with the local data processing."
See the article for your options and the security changes you need to make.