Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLCmd with connection string

Can I Pass connection string via SQLcmd?

I want to change application Name and failover partner (for mirroring) by connection string when use sqlcmd.

Now. When I use sqlcmd, application name of my connection set SQLcmd in sys.sysprocesses result.

like image 327
mehdi lotfi Avatar asked Jun 21 '14 11:06

mehdi lotfi


People also ask

How do I connect to SQL Server using SQLCMD?

Open a Command Prompt window, and type sqlcmd -SmyServer\instanceName. Replace myServer\instanceName with the name of the computer and the instance of SQL Server that you want to connect to. Press ENTER. The sqlcmd prompt (1>) indicates that you are connected to the specified instance of SQL Server.

How do I connect to a SQL Server connection string?

Using a non-standard portServer=myServerName,myPortNumber;Database=myDataBase;User Id=myUsername;Password=myPassword; The default SQL Server port is 1433 and there is no need to specify that in the connection string.

Does SQLCMD use ODBC?

The sqlcmd utility is available with the Microsoft ODBC Driver for SQL Server on Linux and macOS.


1 Answers

Not as far as I know - perhaps consider using osql, with the -D parameter and set up an ODBC connection, which would get you failover partner support at least.

like image 83
MonkeyPushButton Avatar answered Sep 25 '22 01:09

MonkeyPushButton