|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
OSQL Batch File Problemis 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 Hi,
Looks OS user have some perminssion issue. Try scheduling this job using SQL Agent .. Jobs. Thanks Hari SQL Server MVP Show quote "J. Baez" <JB***@discussions.microsoft.com> wrote in message news:D02BC85F-20F3-44C3-B381-B71822BDF219@microsoft.com... >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. Baez > One thing I noticed was the server parameter, -Slocalhost. That
sounds like it means local to where OSQL is running. It is not clear from your description that when you run it manually from the command line you are on the same server as where the scheduled tasks run. Roy Harvey Beacon Falls, CT On Tue, 22 Aug 2006 05:27:01 -0700, J. Baez <JB***@discussions.microsoft.com> wrote: Show quote >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. Baez yes, it is local to where OSQL is running. Everything is being run on the
same windows server that has the scheduled tasks, MS SQL server and OSQL. Show quote "Roy Harvey" wrote: > One thing I noticed was the server parameter, -Slocalhost. That > sounds like it means local to where OSQL is running. It is not clear > from your description that when you run it manually from the command > line you are on the same server as where the scheduled tasks run. > > Roy Harvey > Beacon Falls, CT > > On Tue, 22 Aug 2006 05:27:01 -0700, J. Baez > <JB***@discussions.microsoft.com> wrote: > > >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. Baez > J. Baez (JB***@discussions.microsoft.com) writes:
Show quote > I have a scheduled task that runs a batch file in windows 2003 server No, permissions have nothing to do with it. Then you woould get an error.> 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. I would suggest that you add a SELECT @@servername to the script. Like Roy I'm suspicious of that -S parameter. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
|||||||||||||||||||||||