Can RAISERROR stop install? - 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!

jacktorres
Posts: 2
Joined: Wed Apr 10, 2013 6:55 pm

Can RAISERROR stop install?

Hi,
Its possible to stop install when i provide a RAISERROR in my SQL Script? In my tests the installer keeps running. I want to stop when my backup integrity check fails. For testing purposes, i wrote this snippet inside SQL Scripts in Advanced Installer:

Code: Select all

USE [DE]
BEGIN TRY
	RESTORE VERIFYONLY 
		FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.DOMINIOEMP1\MSSQL\Backup\DE.bak' 
		WITH 
			FILE = 1,
			NOUNLOAD,
			NOREWIND
END TRY
BEGIN CATCH	
	RAISERROR(N'Corrupted backup file', 16, 1)  /* i want to stop install after raiserror */
END CATCH
GO
thanks in advance!!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Can RAISERROR stop install?

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to achieve what you want you can set the "In case of error" combo box, from "SQL Script" tab, to "Abort installation".

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jacktorres
Posts: 2
Joined: Wed Apr 10, 2013 6:55 pm

Re: Can RAISERROR stop install?

Hello Daniel, thanks for your reply!!

I've missed to say that my current settings for this SQL script already include "Abort Installation" option. Im Sorry.
For testing purposes, i miswrote some SQL instructions in my script (SELETC, for instance) and the install behaved as expected, rolling back. But RAISERROR appears to not cause any effect.

Any sugestions?

thanks!!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Can RAISERROR stop install?

Hello,

Unfortunately this happens because we handle only standard errors thrown by SQL scripts (e.g. syntax or semantic errors). I'm afraid that in order to achieve what you want you should build your script to return a standard SQL error when you want to abort installation.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”