Posted By

emregulcan on 02/04/11


Tagged

sql StoredProcedure raiserror


Versions (?)

sql Raiserror with parameters


 / Published in: SQL
 

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

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"

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

Report this snippet  

You need to login to post a comment.