I need to execute this command:
SQLCMD -d dbname -i sc.sql
to run some queries. Since I have both version 2019 and 2016, the query is executed with 2019, but actually I need that on 2016.
I have the same name of database on both version moreover, when I add an instance name:
SQLCMD -S .\MSSQLSERVER -d dbname -i sc.sql
I get an error :
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].