I have a production database off site on another box which I reference by IP. Lets say its IP:
123.45.67.89
Now I want to do a query that references both my server here locally called MYSERVER1 with my production server.
When I try to do:
select count(*) from [MYSERVER1].MyDBName.dbo.mytable;
everything is fine. But I can't do this:
select count(*) from [123.45.67.89].MyDBName.dbo.mytable;
Is there a way to link the servers? Like using sp_addLinkedServer?
I get this error:
Msg 7202, Level 11, State 2, Line 3
Could not find server '123.45.67.89' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.
Any ideas? (I want to copy X number of rows to my production server, that's why)
In SQL Management Studio add your remote server: first connect to your local server, go to Server Objects\Linked Server in the Object Explorer and right click and add a new one.
BTW: you can also do it with system storedprocs, but it is something that you do only occasionally I would stay with the GUI.
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