I would like to make a copy of what's on my remote server at xxx.safesecureweb.com. How do I connect to it from my local SQL Server?
Is the syntax something like:
sp_addlinkedserver
@server='PRODUCTION',
@provider='xxx.safesecureweb.com',
@Username='myUsername',
@Password='myPassword'
What I'm thinking of doing is writing a bunch of insert statements like:
INSERT INTO Test.Table
SELECT * FROM Production.Table
A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources. After a linked server is created by using sp_addlinkedserver , distributed queries can be run against this server. If the linked server is defined as an instance of SQL Server, remote stored procedures can be executed.
The easiest method to view the details for one or all linked servers is the query the SQL Server system tables. Rather than viewing limited information or having to manually view the set-up code for each linked server, a query to the system tables will show amazing detail of all linked servers in one go.
To remove all remote and linked server logins for a server when you remove the server, use the droplogins argument. sp_dropserver cannot be executed inside a user-defined transaction.
You do not specify the remote user and password in the linked server definition. Linked servers have a separate object that mapps the login of users connected to the local server (the 'locallogin') with remote logins. See Security for Linked Servers. For example, the following maps all local logins on the linked server to the specified MyUserName SQL Login:
exec sp_addlinkedserver 'xxx.safesecureweb.com';
exec sp_addlinkedsrvlogin 'xxx.safesecureweb.com'
, 'FALSE', NULL, 'myUserName', 'myPassword';
You can only map with user/password a remote SQL login. Remote Windows logins (trusted authentication) must use integrated authentication and configure the server for constrained delegation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With