sp_setnetname (Transact-SQL)
Sets the network names in sys.servers to their actual network computer names for remote instances of SQL Server. This procedure can be used to enable execution of remote stored procedure calls to computers that have network names containing SQL Server identifiers that are not valid.
Some remote stored procedure calls to Windows computers can encounter problems if the computer name contains identifiers that are not valid.
Because linked servers and remote servers reside in the same namespace, they cannot have the same name. However, you can define both a linked server and a remote server against a specified server by assigning different names and by using sp_setnetname to set the network name of one of them to the network name of the underlying server.
--Assume sqlserv2 is actual name of SQL Server --database server EXEC sp_addlinkedserver 'sqlserv2'; GO EXEC sp_addserver 'rpcserv2'; GO EXEC sp_setnetname 'rpcserv2', 'sqlserv2';
Note
|
|---|
|
Using sp_setnetname to point a linked server back to the local server is not supported. Servers that are referenced in this manner cannot participate in a distributed transaction. |