Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exit isql on error

Status
Not open for further replies.

blakmk

Programmer
Feb 12, 2003
17
GB
Is there anyway to get a script to stop running if an error occurs. In microsft sql server running isql with the -b paramter does this but in sybase the -b parameter disables the display of the table headers output.
 
Hi

Maybe I didn't get enough coffee this morning and that's why I'm not understanding, but HOW Can a script continue running if there's an error?

Dazed and confused...


-=-=-=-=-=-=-=-=-
For ease of reading, any posted CODE should be wrapped by [ignore][COLOR][/COLOR] and
Code:
[/ignore] tags.

Ex:
Code:
SELECT 1 from sysobjects

 
Well it does seem to. Im running the script from a bourne shell using the following arguments:

Code:
RESULT=`isql -U$USERNAME -P$USERPASSWORD -e -S$SQLSERVERNAME -D$DBNAME  -e -i$SQLFILE`
LOG=$?
ECHO $RESULT


The script does seem to throw up errors and continue running. Here is a sample of the output

INSERT into DatabaseInfo (Name, Version, StartTime, EndTime, ActivityByUser, ActivityType, Description) 14> VALUES ('DatabaseType', 'RATINGS', getdate(), getdate(), @l_UserName, 'INFO', 'The database type') 15> 16> INSERT into DatabaseInfo (Name, Version, StartTime, EndTime, ActivityByUser, ActivityType, Description) 17> VALUES ('DatabaseVersion', '1.5.5.90', getdate(), getdate(), @l_UserName, 'INFO', 'The database Version') 18> 19> INSERT into DatabaseInfo (Name, Version, StartTime, EndTime, ActivityByUser, ActivityType, Description) 20> VALUES ('DatabaseStatus', 'OK', getdate(), getdate(), @l_UserName, 'INFO', 'The database status') Msg 102, Level 15, State 1: Server 'gonzo', Line 4: Incorrect syntax near '@l_TruncUser'. Msg 102, Level 15, State 1: Server 'gonzo', Line 7: Incorrect syntax near '@l_UserName'. Msg 102, Level 15, State 1: Server 'gonzo', Line 11: Incorrect syntax near '@l_UserName'.
1> 2> 3> IF EXISTS (SELECT name FROM sysobjects 4> WHERE name = 'PR_LogScriptStart' AND type = 'P') 5> 6> DROP PROCEDURE PR_LogScriptStart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top