Question

SQLCMD uses windows authentication by default. According to the MSDN documentation, you can change it by adding a -U parameter to the command and then the user name.

The problem is with the password. Is there any way to access the sql server if the password is blank?

sqlcmd -U admin
password:

Whenever I try this and just press enter (indicating that the password is an empty string), I get a message saying that the login failed.

Any suggestions? thanks

Was it helpful?

Solution

This forum post http://social.msdn.microsoft.com/Forums/en-US/sqlsecurity/thread/15e4a7c0-6547-44e8-9e25-4f14c12570ca implies that sqlcmd does not support empty passwords. The workaround is to use osql.

However the documentation for sqlcmd here suggests you can use a blank password:

"If the -U option is used and the -P option is not used, and the SQLCMDPASSWORD environment variable has not been set, sqlcmd prompts the user for a password. If the -P option is used at the end of the command prompt without a password sqlcmd uses the default password (NULL)."

Hope one of those helps you!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top