Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Parsing
Message
From
02/04/2021 04:29:54
 
 
To
01/04/2021 12:59:26
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01679440
Message ID:
01679467
Views:
47
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
Previous
Reply
Map
View

Click here to load this message in the networking platform