osql login failed

  • roger-797465

    SSC Enthusiast

    Points: 173

    Using osql on one server to connect to SQL2005 on another server.

    osql -U

    response says:

    'Login failed for user

    Checked the SQL server and is listed as the database owner and in the login list.

    I've tripple checked all of the database, user, and password parms for osql.. but still i'm getting the error..

    Any ideas??

    Thanks in advance,

    Roger

  • roger-797465

    SSC Enthusiast

    Points: 173

    Sorry the command was

    osql -U username -P password -S servername -d databasename

  • MannySingh

    SSChampion

    Points: 12465

    Are you using a windows ID or SQL ID in OSQL -U and just a note, try using SQLCMd insted of OSQL as it will be removed in future versions.

    Also, did you check the login is not ORPHANED.

    Use Databasename

    sp_change_users_login 'Report'

    If it shows up in the Result, it is a Orphaned Login,

    use sp_change_users_login 'update_one','loginname','loginname'

  • tedo

    SSCrazy

    Points: 2169

    osql -E should log you in automatically, however, if you don't want to use that and use another user then type osql -U username -P password

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

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