Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    2

    Unanswered: OSQL inlog troubles

    Hello

    I'am developing a batch or script file to execute at a dos prompt.
    Therefore I want to use a Windows NT user to logon to a MSSQL7 server.
    I use the command:
    OSQL -Scp6411nks99 -dTEST -UDOMAINX\userx
    Before this command I used the stored procedure:
    sp_grantlogin to grant the userx access to the SQL server
    sp_grantaccess to grant the userx acces to the database TEST

    But when I execute the OSQL command and enter the correct password I got a message: Login failed for user 'DOMAINX\userx'

    The server is in Mixed mode.
    When I log on to a workstation with the above mentioned account I can start ISQL and I can login without any problem and execute queries.

    What is the problem with the OSQL command.

    ThanX in regards,

    Ron.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Ini order to use a trusted connection, you have to use the -E switch. This will automatically pick up the name of the user that is running the batch, and use that as the username. Using the -U switch will attempt to use SQL authentication. Hope this helps.

  3. #3
    Join Date
    Sep 2003
    Posts
    2
    Thanx

    This is the answer I was waiting for.

    It works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •