I am trying to find out with SQLEXPRESS is installed on a server by running the following
sqlcmd -S LT1183 -U uname -P pass123 -Q "SELECT @@servername"
If it is installed it gives out the server name but if its not, it throws the below error.
Sqlcmd
: Error: Microsoft ODBC Driver 11 for SQL Server : Login timeout expired.
Sqlcmd
: Error: Microsoft ODBC Driver 11 for SQL Server : TCP Provider: Error code 0x2AF9.Sqlcmd
: Error: Microsoft ODBC Driver 11 for SQL Server : 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.
I am looking for a way to suppress this error and instead show a custom error message. Is that possible?
Thanks in advance.