cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
peterl
Level 2

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
Labels (1)
0 Kudos
(1) Reply
hidenori
Level 17

[ Duplicate post; follow-up posted here. ]
0 Kudos