difference between osql -U and osql -E

  • Trying to use osql directly on my sql server (SQL2005).

    If I use:

    osql -U userid -P password -S server

    This fails... says "Login failed for user "

    If I use:

    osql -E userid -S server

    This works ok.

    The -E is for Windows Authentication right?

    I'm a little confused why I am not able to login using the -U command. I try using the domain name with the userid and it still does not work either.

    Any ideas?

    Thanks in advance,

    Roger

  • The username value you are putting in after the -E is being ignored and you are logging in as a windows user. Connect using -E BLAHBLAHBLAH and run SELECT SYSTEM_USER and you'll see what I mean.

    Good Luck!

    Chad

  • Oh - I forgot to answer your other question. Check to see if mixed mode logins are enabled on the instance, and if so, confirm that the username/password combination are indeed correct. If neither of those work, run a profiler trace to see if the failed login is actually reaching the server and see if TCP/IP is enabled.

    Good Luck!

    Chad

  • I think you can only use SQL Logins with the -U and -P Switch.

    In order to mask your PAssword you can specify OSQL -U username then press enter and in the Password enter the password, which will not be visible.

    NOTE: Try using SQLCMD, instead of OSQL (will be removed in future versions)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply