Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Test cases for SP - how to create?
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01326936
Message ID:
01326971
Views:
20
>>>>I see, let me try. Also check your PM and I'm still wondering how can I quickly jump to the Help on the Error Message.
>>>
>>>I read it, but I have problems with connection to my SQL Server right now. Adobe is downloading its Update and get ALL my network power :-)
>>
>>No rush, I'm manually setting parameters in this SQL statement now. I hate manual typing... :)
>
>HA!
>I think you will not have problems with that. You should use all 6 pairs of hands (Buddha) :-))))
>I just sent you a PM, no need to write ALL parameters.

Well, in addition to lack of extra hands I have a problem with keyboard. It sometimes has mind on its own and starts repeating some letters or numbers. For instance, a minute ago it was typing 66666666666666. Should I consider this as a bad sign? :)

Anyway, while it was doing it I went and took a cup of capuchinno (we have vending machine) and now after I finished typing and executed it it gave me this error (after the normal caught error).

Msg 266, Level 16, State 2, Procedure PersonUpdate, Line 0
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1.

So I guess my CATCH block is written wrongly.
 BEGIN CATCH    
	   DECLARE @ErrorSeverity int, @ErrorNumber int, 
			@ErrorMessage nvarchar(4000), @ErrorState int, 
			@ErrorLine int, @ErrorProc nvarchar(200)
		-- Grab error information from SQL functions
		SET @ErrorSeverity = ERROR_SEVERITY()
		SET @ErrorNumber = ERROR_NUMBER()
		SET @ErrorMessage = ERROR_MESSAGE()
		SET @ErrorState = ERROR_STATE()
		SET @ErrorLine = ERROR_LINE()
		SET @ErrorProc = ERROR_PROCEDURE()
		SET @ErrorMessage = 'Problem updating person''s information.' + CHAR(13) + 
			'SQL Server Error Message is: ' + CAST(@ErrorNumber AS VARCHAR(10)) +
					' in procedure: ' + @ErrorProc + 
					' Line: ' + CAST(@ErrorLine AS VARCHAR(10)) +
					' Error text: ' + @ErrorMessage 

		-- Not all errors generate an error state, to set to 1 if it's zero
		IF @ErrorState = 0
			SET @ErrorState = 1

		RAISERROR (@ErrorMessage , @ErrorSeverity, @ErrorState, @ErrorNumber)

		-- If the error renders the transaction as uncommittable, we must rollback
		IF XACT_STATE() < 0
			ROLLBACK TRANSACTION
  END CATCH
Looks like RaiseError should be the last statement in the catch, right?

I think I took this directly from Kevin, so he also may have this problem.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform