October 23, 2002 at 5:39 am
All I want to do, to help automate my error handling process, is to be able to set a variable equal to the stored procedure name while the procedure is running; without hard coding it.
something like:
declare @procname sysname
select @procname = proc_name from magic_place
Any ideas???
TIA
October 23, 2002 at 6:25 am
You can call dbcc inputbuffer to get what the calling code was, but not the current procedure name. In addition you cannot redirect dbcc commands to a table
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
October 23, 2002 at 6:39 am
I think I found the trick, this appears to work:
CREATE PROCEDURE testprocedure AS
SELECT OBJECT_NAME(@@ProcID) as ProcedureName
GO
EXEC testprocedure
GO
October 23, 2002 at 7:31 am
Well you learn somthing every day
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply