SQLCMD Login Issue

  • I have had 2 occasions where a batch, using SQLCMD on a SS2014 box has failed because the -U<username> does not have a -P. The password is null, and must remain as such for now. It is a read only login. This has been running through a scheduler system (Tidal) for quite awhile and today started failing for password.

    I have tried, as MS says, to place the -P at the end of the string without a password. This is supposed to use a default of NULL. Still no success.

    Has anyone had this issue, and solved it? If so, what was your solution. For now I have set this to a trusted connection. But there are others where this will not work.

    Thanks.

    :w00t:

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • Does the password have to be NULL? Or can it be blank? Can you set the SQLCMDPASSWORD environment variable?

    The docs definitely support that this should work. My guess is SQLCMD got altered to toss an error with -P and nothing else.

    Any reason why a password can't be set? If you're making a SQLCMD call from Tidal, and you specify things, can't you add a param?

  • Steve Jones - SSC Editor (6/14/2016)


    Does the password have to be NULL? Or can it be blank? Can you set the SQLCMDPASSWORD environment variable?

    The docs definitely support that this should work. My guess is SQLCMD got altered to toss an error with -P and nothing else.

    Any reason why a password can't be set? If you're making a SQLCMD call from Tidal, and you specify things, can't you add a param?

    Unfortunately there is no way to change the password. It is this way because of a limitation on a software that is still being used, a reporting system which is slowly being done away with.

    The SQLCMDPASSWORD has been set SQLCMDPASSWORD = , which has not worked either That was the first thing I tried. I can't get OSQL to work either. Guess with SS2014 they finally removed it. It keeps giving me errors.

    So now I am grasping at straws, as the developers here have used this login so heavily.

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • No idea. I'm not even sure how to set a password to NULL. I can set it to blank, but not NULL, at least not that I see in 2014/2016.

    If you can set the environment variable, I'd set it to '' or NULL, not just nothing.

  • From MS:

    Use -P "", double quotes, which should work. I'm guessing this might work for SQLCMDPASSWORD as well.

    If not, can you use isql/osql instead?

  • Steve Jones - SSC Editor (6/14/2016)


    From MS:

    Use -P "", double quotes, which should work. I'm guessing this might work for SQLCMDPASSWORD as well.

    If not, can you use isql/osql instead?

    This was it. I had tried single quotes. Unfortunately, I was receiving an error with osql on this box.

    THANKS for the assist.

    🙂

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • Cheers, and glad it worked. Sorry I didn't think of it 🙁

Viewing 7 posts - 1 through 6 (of 6 total)

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