I have a quite weird situation. I'm using sqlcmd to run a script with the command:
sqlcmd -S %SName% -U %UName% -P %Pwd% -d %DbName% -I -i test.sql >> test_log.txt 2>&1
SName is the IP\Instance like 10.10.10.100\MyInstance
The content of test.sql is simply:
select @@servername
select getdate()
When I run it gives me the following error:
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Data source name not found and no default driver specified.
***If I copy and paste the script into another machine and run it works fine.
Why is it trying to connect via ODBC?
I believe it's an environment issue but I don't know where to start looking.
Thanks