Here is the stored procedure:
CREATE PROCEDURE dbo.TestTestTest AS
BEGIN
DECLARE @ProcedureIdForTracking varbinary(128) = CONVERT(varbinary(128), @@procid)
DECLARE @ProcedureNameForTracking varbinary(128) = CONVERT(varbinary(128), OBJECT_NAME(@@procid))
SELECT @@procid AS originalProcid, @ProcedureIdForTracking, CONVERT(bigint, @ProcedureIdForTracking) AS ConvertBackId
SELECT OBJECT_NAME(@@procid) AS originalName, @ProcedureNameForTracking, CONVERT(varchar(1000),
@ProcedureNameForTracking) AS ConvertBackName
SET CONTEXT_INFO @ProcedureNameForTracking
END
I can recover the @@procid from the converting, but not the stored procedure name. Any idea?Anything wrong with the OBJECT_NAME function?