Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004

    Unanswered: using osql to run a sql script remotely

    I'm attemping to run an sql script remotely by using osql. It works in a test environment (remotely) but when I attempt it on our production server (remotely), it fails.

    Alternatively, if I run osql in the production server (locally), the script executes fine.

    Should I be doing this via a different method or are there some security settings preventing me from using osql remotely in my production environment?

    Thanks for any help,

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Did you just copy osql.exe to the machine, or did you actually install the SQL Client tools on it? Without at least the MDAC, osql gets really grumpy. It takes a SQL client install to make osql really solid.


  3. #3
    Join Date
    Sep 2004
    Thanks for the reply.

    I did it both ways. On one remote machine the client tools were not installed, so I just copied osql.exe and attempted to connect, but it was not successful.

    I tried it on another machine which did have the client tools installed, but it still didn't work. However, the error I received was slightly different, but it still said that the specified user didn't have "permission."

    Any thoughts?


  4. #4
    Join Date
    Jul 2003
    San Antonio, TX
    If you're using Windows authentication (which I think you do) then you can use "Run as...", but it still does not prevent the final batch file to contain a clear text password, in this case of the Windows account under which you want the script to run. The best way is to "shorten" your script down to just invokation of the scheduled task on the target server, in which case the actual script will run under security context of SQL Agent account, which I hope has sufficient permissions.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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