Wednesday, July 4, 2012

Stored Procedure to raise a message

CREATE PROCEDURE [dbo].[usp_Raise_Message]
@strMessage NVARCHAR(MAX) = NULL -- Message to display
AS
BEGIN
SET NOCOUNT ON
SET @strMessage = CONVERT(NVARCHAR(100),GETDATE()) + ' : ' + ISNULL(@strMessage,'No Message Raised')
RAISERROR(@strMessage,0,1) WITH NOWAIT
END

No comments:

Post a Comment