SQL Script return value - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Ira Rainey
Posts: 4
Joined: Mon Jul 20, 2009 11:28 am
Contact: Website

SQL Script return value

I can't find any way, but I want to check before I give up, to get the return value of a SQL Script.

In the first script of my installer I create an MS SQL database, which at the moment performs a DROP DATABASE before creation, which has been fine going though development, but now I want to alter the script to simply check for the existence of the database, and if it does exist then drop out of the installer with a dialog telling the user that the database already exists on the selected server.

Is this possible?

Obviously if I just remove the DROP statement the CREATE will fail because the database exists and the installer will stop because an error has occurred, but I want a slightly more slick way of dropping out rather than an error dialog.

I'm using 7.3.1
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: SQL Script return value

Hello Ira,

I am afraid there is no support for this. This behavior can not be implemented, as the custom action running the sql script is running deferred, thus can not set properties.

What you can do is ask the user during the installation UI whether he wants to drop the database or not should it already exist. For this, use the Dialog Editor on the Dialogs page. Store the user's option inside a property and use that property in your SQL script to take corresponding action (drop database and create a new one or some other action depending on what he selected).

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Ira Rainey
Posts: 4
Joined: Mon Jul 20, 2009 11:28 am
Contact: Website

Re: SQL Script return value

Gabriel,

Thanks for that. Is there any chance of getting it implemented in the future? That would be great enhancement.

Cheers

Ira
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: SQL Script return value

Hi Ira,

This is not possible to implement for the reason I mentioned in my previous post:
This behavior can not be implemented, as the custom action running the sql script is running deferred, thus can not set properties.
I hope this is not an inconvenience.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”