SQL Server Network Interfaces: Connection string is not valid .
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.
qlcmd –S SERVERNAME\SQLINSTANCE –i C:\filepath\sqlquery.sql we get above error.
To resolve the problem change command line to;
sqlcmd –S localhost –i C:\filepath\sqlquery.sql
Make sure -S is in uppercase and -i is in lowercase.