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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Names of the following ServerName, DatabaseName & ObjectName (sproc)

Status
Not open for further replies.

SteveMe

MIS
Aug 30, 2002
83
US
How do I determine the Stored procedure name?

I know how to find the
ServerName -- @@ServerName
Database -- db_name()
Object(Stored Procedure) -- ?????

This code would run in a Stored Procedure.
Thanks in advance
 
OBJECT_NAME(@@PROCID) ?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
What if its the current Sproc and you don't know the associated ID or how can you get the current sproc associated ID?
 
Run this:
Code:
create procedure blahproc
as
	select @@PROCID, object_name(@@PROCID)
go

exec blahproc
drop proc blahproc
Does @@PROCID stuff work as expected?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top