In a script I have the directive
:connect DbServer
and it seems that if I run this script in SQLCMD (like this:
sqlcmd -i script.sql
then sqlcmd attempts to connect using Named Pipes (which doesn't work). I get error messages saying that Named Pipes provider could not connect. However, if I try to connect to the same server by specifying its name in the -S parameter, it works fine.
Is there a way to let the :connect directive know that I am trying to connect by TCP/IP?
I tried using :connect tcp:DbServer to no avail. Also tried to go by IP address, same results. On this machine I don't have the SQL Server Configuration Manager to specify connectino aliases or manipulate protocols. Maybe that's the next thing to do, but I'd like to know if somebody knows a way to contain the connection specification inside the script.