Wednesday, March 7, 2012

OSQL Batch File Problem

I have a scheduled task that runs a batch file in windows 2003 server which
is running SQL Server 2000 Enterprise.
The batch file contains the line:
OSQL -i myscript.sql -Umyuser -Pmypassword -Slocalhost -o mytrans.log
the 'myscript.sql' file updates a table with another table of the exact
number of rows.
When the scheduled task runs, the 'mytrans.log' file shows 0 rows were
affected.
If I run this myself from the command line, 22,000 rows are affected which
is correct.
I am guessing there is some sort of permission/authentication issue here. I
am sending the right username/password for SQL and for windows to run the
task.
Any idea what I could do to fix this?
Thanks,
J. BaezGo to schedule tasks -- Tasks tab--See the user in RUN AS: . The user
displayed there should be having write access to the folder you are writing
the log file.
After that just right click and run the task and see.
Thanks
hari
SQL Server MVP
"J. Baez" wrote:

> I have a scheduled task that runs a batch file in windows 2003 server whic
h
> is running SQL Server 2000 Enterprise.
> The batch file contains the line:
> OSQL -i myscript.sql -Umyuser -Pmypassword -Slocalhost -o mytrans.log
> the 'myscript.sql' file updates a table with another table of the exact
> number of rows.
> When the scheduled task runs, the 'mytrans.log' file shows 0 rows were
> affected.
> If I run this myself from the command line, 22,000 rows are affected which
> is correct.
> I am guessing there is some sort of permission/authentication issue here.
I
> am sending the right username/password for SQL and for windows to run the
> task.
> Any idea what I could do to fix this?
> Thanks,
> J. Baez|||That user already has full control of that directory. So it still not
working. Any other ideas?
"Hari Prasad" wrote:
[vbcol=seagreen]
> Go to schedule tasks -- Tasks tab--See the user in RUN AS: . The user
> displayed there should be having write access to the folder you are writin
g
> the log file.
> After that just right click and run the task and see.
> Thanks
> hari
> SQL Server MVP
> "J. Baez" wrote:
>

No comments:

Post a Comment