SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


how to trap dos errorlevel when sqlcmd execution timout ?


how to trap dos errorlevel when sqlcmd execution timout ?

Author
Message
pierrejean
pierrejean
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
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,

--


Site Owners
Site Owners
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: Administrators
Points: 12697 Visits: 22
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!
JohnnyDBA
JohnnyDBA
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1544 Visits: 897
I realize this is very old, but this is still unanswered. Anyone know the solution to this?
Snigdha Vartak
Snigdha Vartak
Say Hey Kid
Say Hey Kid (704 reputation)Say Hey Kid (704 reputation)Say Hey Kid (704 reputation)Say Hey Kid (704 reputation)Say Hey Kid (704 reputation)Say Hey Kid (704 reputation)Say Hey Kid (704 reputation)Say Hey Kid (704 reputation)

Group: General Forum Members
Points: 704 Visits: 247
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search