18

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.

3
  • can you set up a scheduled task to run as a specific user? If so, I think the -E argument with sqlcmd is what you are looking for. Commented Mar 29, 2013 at 10:56
  • 1
    Solution: go to Google, search for SQL Server SQLCMD, pick the first link which leads you to the official MSDN documentation for SQLCMD, read the docs, see that you need to use -E for integrated security - was that so hard? Commented Mar 29, 2013 at 11:26
  • 8
    @marc_s it does imply that you know that Windows Authentication == Integrated Security == Trusted Connection, which is not necessarily obvious. Commented Oct 7, 2013 at 19:18

1 Answer 1

27

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

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.