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.
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.
sqlcmd
takes the -E
argument, which means, "Use Trusted Connection"... IOW, your windows credentials.
http://msdn.microsoft.com/en-us/library/ms162773.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With