Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine sproc name within the spoc itself 2

Status
Not open for further replies.

buddafish

Programmer
Apr 26, 2002
478
US
All -

I would like to be able to determine the stored procedure name from within the procedure itself. Kind of like what I do with the database name:

SELECT @DB_NAME = db_name()

Anybody know a way to get the procedure name? Ideas?

Thanks in advance -
Scottie
 
I don't know of a way, but if I had this as a requirement, I would just hard code the name to a variable inside the stored procedure.
 
well, that appears like the perfect answer, yet for me, i return null for the object_name. select * from sys.procedures shows the sproc by name and object_id, but the object_id <> @@procid. ??

thanks for the reply. i will keep kicking it around.
 
You have to use that within the stored procedure. If you run that on it's own, then yes, you will get a NULL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top