Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jacobhackl/e36d4982ef04b6297aa9589f3ab0bace to your computer and use it in GitHub Desktop.
Save jacobhackl/e36d4982ef04b6297aa9589f3ab0bace to your computer and use it in GitHub Desktop.
Add linked server for sql server in aws rds
EXEC sp_addlinkedserver
@server=N'wradminlite', -- Linked Server Display Name
@srvproduct=N'SQL Server', -- Default to SQL Server
@provider=N'SQLNCLI', -- Use SQLNCLI
@datasrc=N''; -- VPC IP of remote server, force TCP mode
EXEC sp_addlinkedsrvlogin @rmtsrvname = 'wradminlite' -- Linked Server Display Name
, @useself = 'false' -- Do not masquerade
-- , @locallogin = '' -- Commented out to force all local users to use linked login
, @rmtuser = '' -- Remote user name
, @rmtpassword = ''; -- Remote password
@pfalabella
Copy link

Thanks for this.
I was getting a "You cannot specify a provider or any properties for product 'SQL Server'." error.
I had to leave @srvproduct=N'' instead of @srvproduct=N'SQL Server' as per example here: https://msdn.microsoft.com/en-us/library/ms190479.aspx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment