March 12, 2003 at 9:43 am
Does anyone know how a batch file can determine if ISQLW has processed SQL commands without errors?
I was hoping to use IF ERRORLEVEL, but that doesn't seem to be working out for me. For example, this little batch file has a typo in the name of the Products table, but ISQLW returns an ERRORLEVEL of 0.
echo SELECT * FROM Producks > Statements.sql
isqlw -S localhost -d Northwind -U SA -P -i Statements.sql -o Results.txt
echo Error level is %ERRORLEVEL%
type Results.txt
March 12, 2003 at 10:46 am
That's because there is no fatal error, so isql exits correctly.
I think you would need to trap the error and drop it into a table. Then query that table from another script and parse the results. Most likely you need to script this rather than use ISQL.
Steve Jones
March 13, 2003 at 4:37 am
Try using isql with -b parameter.
Far away is close at hand in the images of elsewhere.
Anon.
March 13, 2003 at 9:38 am
Just the solution I was looking for!
For the record, both ISQL and OSQL support the -b option. The -b option returns an ERRORLEVEL of 1 for SQL Server errors with severity of 10 or greater.
Thanks, John Craft
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply