I am trying to connect to a remote sql server and get the value of the @@servername, assign it to a variable and print it. Here is the code:
:SETVAR INSTANCE @@servername
SET @SERV = $(INSTANCE)
When I run the sql in SSMS (2008 R2) I get the following:
Connecting to REMOTE_SERV\MYINSTANCE...
Disconnecting connection from REMOTE_SERV\MYINSTANCE...
Is it possible to do what I am trying to do?
View Complete Post