Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use `sqlcmd` command without username and password in SQL Server 2008?

How can I run commands, passed to sqlcmd, as currently logged on user automatically i.e without having to enter username and password?

I want to use Windows Authentication only. It is a local server.

like image 817
Aashiq Hussain Avatar asked Mar 29 '13 10:03

Aashiq Hussain


People also ask

How do I use Windows authentication in SQLCMD?

Answers. You can use the runas command from the command line. Either start a new Command Prompt as that user or start a sqlcmd directly. Use the SUSER_NAME() function to verify you are logged in as right user.


1 Answers

sqlcmd takes the -E argument, which means, "Use Trusted Connection"... IOW, your windows credentials.

http://msdn.microsoft.com/en-us/library/ms162773.aspx

like image 186
Jeremy Holovacs Avatar answered Jan 06 '23 09:01

Jeremy Holovacs