This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- SQL scripts, On Error, Aborted Installation is not working ...
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 25, 2015
02:25 PM
SQL scripts, On Error, Aborted Installation is not working ...
What SQL error does InstallShield expects?
The installation is using default settings for SQL scripts, 'On Error, Abort Installation'.
When sql script RAISERROR(.....) with error severity = 16, error state = -1 (or 1), installshield continues and does not catch the error; thus did not abort the installation.
Here is the code snippet.
BEGIN TRY
SET XACT_ABORT ON
RAISERROR (N''*** Testing: Force failure ... ***'', 16, 1)
// ..............
END TRY
BEGIN CATCH
DECLARE @errorMessage VARCHAR(1000)
SET @errorMessage = 'ERROR ' + CAST(ERROR_NUMBER() AS VARCHAR(10)) + ': ' + ERROR_MESSAGE() + ' AT ' + CAST(ERROR_LINE() AS VARCHAR(10))
PRINT @errorMessage
INSERT INTO InstallationErrors (time, descriptions) VALUES (GETUTCDATE(), @errorMessage)
RAISERROR (@errorMessage, 16, -1)
END CATCH
The installation is using default settings for SQL scripts, 'On Error, Abort Installation'.
When sql script RAISERROR(.....) with error severity = 16, error state = -1 (or 1), installshield continues and does not catch the error; thus did not abort the installation.
Here is the code snippet.
BEGIN TRY
SET XACT_ABORT ON
RAISERROR (N''*** Testing: Force failure ... ***'', 16, 1)
// ..............
END TRY
BEGIN CATCH
DECLARE @errorMessage VARCHAR(1000)
SET @errorMessage = 'ERROR ' + CAST(ERROR_NUMBER() AS VARCHAR(10)) + ': ' + ERROR_MESSAGE() + ' AT ' + CAST(ERROR_LINE() AS VARCHAR(10))
PRINT @errorMessage
INSERT INTO InstallationErrors (time, descriptions) VALUES (GETUTCDATE(), @errorMessage)
RAISERROR (@errorMessage, 16, -1)
END CATCH
(1) Reply
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)