+ Reply to Thread
Results 1 to 3 of 3

Thread: how do i get error details from running a sql script?

  1. #1

    Default how do i get error details from running a sql script?

    hi there,

    i am using the 'run command line' function to run osql.exe which executes a sql script on a sql server. i then look at %_SB_ERRORCODE% to confirm it ran ok.

    it seems to me that %_SB_ERRORCODE% only produces a 1 or 0 for an osql execution. this makes installation troubleshooting a bit difficult because an error could occur in numerous places and it would be useful to let the user know exactly what type of error occurred. eg it could be a problem with a foreign key violation in the database, or it could be that the user does not have permissions on the sql server.

    i found some previous forum posts that advise that native sql execution is on the cards for SetupBuilder some time in the future. has this been progressed? if not, is there a way of getting the precise error details for an osql execution?

    thanks

    rob

  2. #2
    Join Date
    Mar 2004
    Posts
    4,308

    Default Re: how do i get error details from running a sql script?

    Rob,

    If you are using the "Run Command Line" function, then %_SB_ERRORCODE% holds the return value of the CreateProcess Windows API (if it succeeded) or the value of GetLastError (if available) if it failed.

    I would suggest to use the "Run Program" function -- this allows you to retrieve the ExitCode of the executed application (if it returns any code).

    Does this help?

    Friedrich

  3. #3

    Default Re: how do i get error details from running a sql script?

    hi frederich,

    thanks for your post.

    i believe i am already doing this but i only get back a 0 or a 1 for success or failure. if an error has occurred, there is no useful information to feed back to the user to tell him/her which particular part of the sql execution failed. ideally i would like to know if there is a mechanism by which the sql error code and the sql error text can be put into SetupBuilder variables and displayed to the user to show why the install failed. i would imagine that this requires native support for execution of tsql commands. i have seen other posts to this forum that indicate execution of tsql commands is on the drawing board. is it likely to be included in SetupBuilder any time soon?

    (http://www.lindersoft.com/forums/sho...&highlight=sql)

    thanks

    rob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •