Search code examples
sql-server-2008authenticationsqlcmd

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.


Solution

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

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