Connect to SQl Server from command prompt

Posted 14 October 2018 by Darren Welch

If you find yourself needing to connect to an instance of SQL Server without Sequel Server Management Studio installed you can connect via command Prompt.

To connect using SQL authentication you need to use the following command:

sqlcmd /S /d -U -P

/S = the servername/instance name. Example: 11.111.11.11/SqlServ

/d = the database name. Example: DB1

-E = Windows authentication.

-U = SQL Server authentication/user. Example: darrenwelch

-P = password that belongs to the user. Example: 123456789

 

sqlcmd /S 11.111.11.11/SQLServ /d DB1 -U darrenwelch -P 12345678 

 

Once connected you can type your query & press enter, then type go and press enter. This will display your results.:

select * from table 1
GO




Darren Welch

By

Darren Welch


  14 October 2018


Contact me online

Advertisment


Tags


computing database IT technology

Related Content




How to prioritise a string in select statement

15 May 17




How to reset your Umbraco password via the database

30 Mar 17