Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Parsing
Message
De
02/04/2021 04:29:54
 
 
À
01/04/2021 12:59:26
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01679440
Message ID:
01679467
Vues:
48
Hi, Mike

I hate to just say, "try this code sample", but there are 2 things I want to see if you can try.
(Separate note, maybe this was a typo, but I think you had the function spelled as RAISEERROR...it's RAISERROR ("RAIS-ERROR")

Regardless, this topic has often resulted in me fiddling with code and always wondering if I completely understand what RAISERROR is doing.

Anyway, give either one of these a try....if they don't work, I'll try again.

Either this...
DECLARE @ErrNum INT
	declare @errorseverity int  
		declare @errorstate int  
	SET @ErrNum = 0
	BEGIN TRY
		BEGIN TRANSACTION
		select 1/0
		COMMIT TRANSACTION
	END TRY
	BEGIN CATCH
		ROLLBACK TRANSACTION
		SET @ErrNum =ERROR_NUMBER()
		set @errorseverity = error_severity()
		set @errorstate  = error_state()
			RAISERROR('this is my error', @errorseverity, @errorstate)
			
		END	catch
Or throw (using THROW instead of RAISERROR
DECLARE @ErrNum INT
	declare @errorseverity int  
		declare @errorstate int  
	SET @ErrNum = 0
	BEGIN TRY
		BEGIN TRANSACTION
		select 1/0
		COMMIT TRANSACTION
	END TRY
	BEGIN CATCH
		ROLLBACK TRANSACTION
		SET @ErrNum =ERROR_NUMBER()
		set @errorseverity = error_severity()
		set @errorstate  = error_state()
		print @errnum
		print @errorseverity
		print @errorstate;
		throw;
			
		END	catch
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform