Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sysbob
Starting Member
2 Posts |
Posted - 2004-10-25 : 01:27:29
|
| the help document said that"osql -b will specifies that OSQL exits and returns a DOS ERRORLEVEL value when an error occurs. The value returned to the DOS ERRORLEVEL variable is 1 when the SQL Server error message has a severity of 10 or greater; otherwise, the value returned is 0."my question is : how can I get the DOS ERRORLEVEL.example:C:\>isql -E -b -Q"backup log pubs to disk='C:\adsfasd.tmp'"the result:Msg 4208, Level 16, State 0, Server YANG, Line 1µ±»Ö¸´Ä£ÐÍΪ SIMPLE ʱ£¬²»ÔÊÐíʹÓà BACKUP LOG Óï¾ä¡£ÇëʹÓà BACKUP DATABASE »òÓÃALTER DATABASE¸ü¸Ä»Ö¸´Ä£ÐÍ¡£Msg 3013, Level 16, State 1, Server YANG, Line 1BACKUP LOG ²Ù×÷Òì³£ÖÕÖ¹¡£It's in chinese language,means"can not use BACKUP LOG when the restore model being SIMPLE,you can use ALTER DATABASE or BACKUP DATABASE to change the restore model.Msg 3013, Level 16, State 1, Server YANG, Line 1BACKUP LOG aborted"where is DOS ERRORLEVEL???? How can I get it????thanks |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-10-25 : 01:31:19
|
| Make a MyFilename.BAT file:@ECHO OFFosql -E -b -Q"backup log pubs to disk='C:\adsfasd.tmp'"IF ERRORLEVEL 1 GOTO GotErrorECHO Processed OKGOTO END:GotErrorECHO Error Occurred... put any other error handling logic here ...:ENDECHO.Kristen |
 |
|
|
|
|
|
|
|