Issues with sp_addlinkedserver in SQL Server 2000

I have a problem moving certain data from one server with SQL Server 2000 (A) and another running SQL Server 2008 (B). I am writing a script in accordance with the requirements of the customer, which must be executed on A, filling tables B with data. However, it seems like I cannot get the server link to work.

-- Bunch of declarations here

EXEC sp_addlinkedserver @server = @ServerName,
            @srvproduct = @ServerProduct,
            @provider = @ProviderString,
            @datasrc = @RemoteHost

-- Data migration stuff here

EXEC sp_dropserver @ServerName

Now, if I run the script completely, I get an error message:

Msg 7202, Level 11, State 2, Line 55 Could not find the server 'remoteServer' in sysservers. execute sp_addlinkedserver to add a server for sysservers.

However, if you select only a part sp_addlinkedserverand execute it, there is no error, and I can select the rest of the script and run it. What am I missing here?

Please, help!

PS. , .

+3
1

, SQL Server . , EXEC(). GO sp_addlinkedserver.

+2

Source: https://habr.com/ru/post/1750510/


All Articles