I am writing a system that reads from a remote server and read/write to a local server. I am at the point where I now have to query data from both the remote server and my local server together (for example: if the remote server had the user's address and my local server has the user's phone number, I want to query both databases and get results that contain both the user's address and phone number in one return).
I recently learned about linked server and wanted to update my code to use it, but I am having trouble getting started.
I am using SQL Server Management and have both my LocalDB
and LinkedServerDB
on it (see reference screenshot).
But when I try to reference the LinkedServerDB
in my LocalDB
stored procedure, it doesn't seem to recognize the linked server. I googled a few examples and it seems like people were able to reference it in this manner:
[ServerName].[Database].[dbo].[TableName]
But it doesn't seem to recognize the syntax when I write it in that manner. Is there a settings I need to toggle to make this work? Is what I'm trying to do possible?
Any assistance or guidance is greatly appreciated.