Return to Snippet

Revision: 40619
at February 4, 2011 11:48 by emregulcan


Initial Code
DECLARE @raiseErrorCode nvarchar(50)
SET @raiseErrorCode = CONVERT(nvarchar(50), YOUR UNIQUEIDENTIFIER KEY)
RAISERROR('%s INVALID ID. There is no record in table',16,1, @raiseErrorCode)

Initial URL
http://msdn.microsoft.com/en-us/library/ms178592.aspx

Initial Description
You can see details on http://msdn.microsoft.com/en-us/library/ms178592.aspx , but I try to explain how you throw error with "uniqueidentifier" type parameters.

I convert uniqueidentifier to string (nvarchar(50)) and set a variable.
"%s" is equal to "string"

Initial Title
sql Raiserror with parameters

Initial Tags
sql

Initial Language
SQL