I have a logging function in T-SQl similiar to this:
CREATE PROCEDURE [logging]
@PROCEDURE VARCHAR(50),
@MESSAGE VARCHAR(MAX)
AS
BEGIN
PRINT @MESSAGE
END;
GO
I am able to call it like this:
execute logging N'procedure_i_am_in', N'log_message';
As my stored procedure names are a bit long winded, I want to write an alias or an inline function or so, to call the logging procedure for me, with the current procedure. Something like this (which is broken):
declare @_log varchar(max)
set @_log = 'execute logging N''procedure_i_am_in'', '
execute @_log N'MESSAGE!'
And i would put that alias at the top of each procedure.
What are your thoughts?