Handling Response from a call to Stored Procedure via Batch File

  • Hi,

    I am very New to the SQL SERVER and its various jargons. This is probably a very basic query but looking around was not of much help.

    I am Trying to execute and handle response from a call to stored proc but unable to handle the responses correctly.

    Below is a snippet of the code.

    osql /Uusername /Ppassword /S ServerName /d DbName /q "exit(exec Stored_Proc)"

    Echo %ErrorLevel%

    The process i am trying to achieve is to to skip processing of further steps if the call to stored proc was a failure.

    Upon executed the above code, the ErrorLevel -100 is displayed even though the call went thru and the stored proc processing is happening correctly. I am not sure about how to go about handling this response or if this actually the response from the call being made.

    Googling around gave me details about what -100 is (Error encountered prior to selecting return value) but could not find anything about to how to fix it.

    If any of you could please provide some directions on what is going wrong or what corrections i need to make, it would reallu be very helpfull.

    Thanks Very Much for your Help,

    Arun.

  • This thread discusses the topic in depth: http://www.sqlservercentral.com/Forums/Topic1188295-392-1.aspx

    Don't use osql: it's old. The replacement is sqlcmd.

    -- Gianluca Sartori

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply