Tags: , | Categories: Knowledgebase Posted by Ian Blair on 2/27/2011 11:18 AM | Comments (0)

To discover the network name of the server that SQL is physically located on, the extended stored procedure xp_getnetname can be used.

On its own it simply returns a result set containing the netname of the server, however it can be used within a sql script by including the following code:


declare @netname varchar(100)
exec master..xp_getnetname @netname OUTPUT
print @netname

 

Comments are closed