Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

how to trap dos errorlevel when sqlcmd execution timout ? Expand / Collapse
Author
Message
Posted Thursday, February 8, 2007 4:57 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 17, 2008 8:39 AM
Points: 3, Visits: 4

Hello,

I test %ERRORLEVEL% in a .bat file who execute sqlcmd -b -l 1 -t 1 ...

but sqlcmd exits with success (dos errorlevel = 0) when execution time out !!!

I test with options -m-1 and -V1 but it doesn't work.

 

any idea how to trap dos errorlevel when sqlcmd execution timout ?

 

Thanks,

 

--

Post #343395
Posted Monday, February 12, 2007 8:00 AM
SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,039, Visits: 1
No one has responded to this topic yet. Even if you don't have a complete answer, the original poster will appreciate any thoughts you have!
Post #344204
Posted Monday, July 22, 2013 12:46 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 3:39 PM
Points: 340, Visits: 797
I realize this is very old, but this is still unanswered. Anyone know the solution to this?
Post #1476215
Posted Wednesday, August 21, 2013 2:26 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, July 17, 2014 3:41 PM
Points: 522, Visits: 234
Hi,

Not tried it by myself but may be useful to you:

sqlcmd <yourscript>
IF ERRORLEVEL 1 goto err_handler
goto done
:err_handler
REM handle the error here

:done
REM script completion code here

Ref: http://stackoverflow.com/questions/5795430/error-handling-with-batch-file-sqlcmd
Post #1486931
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse