Search code examples
sql-servertestingautomated-testsqtphp-uft

Retrieve error message from MS SQL to QTP


I have to load files to MS SQL using stored procedure:

exec [database].[dbo].[tablename]  @FullFilePath = 'fullpathtofile'

Files are big and loading may last several minutes up to 40 minutes. UFT returns 'timeout' error in 20-30 seconds. Need help to make UFT wait until files are loaded. Fixed wait() doesn't make sense, because I do not know how long exactly it may take.

For each objError in dbConnectionChargebacks.Errors gives me messages (like 50000 as loading error or 3105 as fileID for successful load). But it works only when file is loaded in <20 seconds. For big files, I don't know how to wait for that)


Solution

  • Agree with @Dave. store your procedures in a batch file and using Wscript object, you can execute that file

    Set Wsc = CreateObject("Wscript.Shell")
    intReturn = Wsc.Run("cmd /c " & PathofbatchFile, 1 True) 'true will wait until batch file returns completion code
    

    0 is the return code for success.