osql login failed

  • 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

  • Sorry the command was

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

  • 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'

  • 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 3 (of 3 total)

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