How to get error from SQLCMD

  • Hi All

    I am running SQLCMD from UFT. The issue is that no matter what the result of SQLCMD run is (pass or fail) the result of this cmd run gives me only 0. Can anyone help me with syntax for this so that if SQLCMD fails, i get some other result like 1 or something? I am not able to get one single output to say whether the run was succesful or not. Please helP!!!

    Dim WSHShell

    Set WSHShell=CreateObject("WSCript.Shell")

    Dim Runquery1

    Runquery1="SQLCMD -S .........."

    ErrorfromSQL=WSHShell.Run (Runquery1,1,True)

    am I missing something here?

    Please help if you can

    Malini

    ....

  • Quick thought, redirect the stderr to the output using 2>&1

    😎

  • Hi 🙂

    Yes i did try that ...to get stderr to an output file. But is it possible to do it internally through some variable?

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

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