Command Prompt connectivity –U option

When you try to connect to sql server using isql/osql or sqlcmd there are two authentication you can use windows authentication and sql authentication.

-E option is used for windows authentication where you domain windows login which you have connected to will be used(your windows credential).

Eg. Domainname/loginname

There is other option

-U which uses only SQL authentication you cannot specified here other windows user to works with it should be only sql login and this option should have its passward option

-P to specify sql login password.

if you try to use domain account with -U option you will get error

“msg 18456 level 14 state 1 server”

invalid user name…

If you want to use different windows login you have to run your command prompt with “Run As” option and specified –E which will use the run as authentication.

I was confused on –U option to use Windows authentication as well but its false.

Hope this will clarify someone’s confusion as well.

Thanks for reading.


This entry was posted in Basic, Limitation and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.