Home All Groups Group Topic Archive Search About

How to get the SP name in the SP?

Author
14 Sep 2006 2:51 AM
Cylix
I have a sp name "dbo.helloWorld"
How can I get the it's name "helloWorld" in the sp?

Thank you.

Author
14 Sep 2006 2:49 AM
Hari Prasad
Hi,

You could use the function @@PROCID

Sample

Create Proc helloworld
as
Begin
    select object_name(@@PROCID)
End

Thanks
Hari
SQL Server MVP




Show quote
"Cylix" <cylix2***@gmail.com> wrote in message
news:1158202260.707579.30820@m73g2000cwd.googlegroups.com...
>I have a sp name "dbo.helloWorld"
> How can I get the it's name "helloWorld" in the sp?
>
> Thank you.
>
Author
14 Sep 2006 2:59 AM
Dan Guzman
> How can I get the it's name "helloWorld" in the sp?

You can pass the @@PROCID to the OBJECT_NAME function.  For example:

SELECT OBJECT_NAME(@@PROCID)

--
Hope this helps.

Dan Guzman
SQL Server MVP

Show quote
"Cylix" <cylix2***@gmail.com> wrote in message
news:1158202260.707579.30820@m73g2000cwd.googlegroups.com...
>I have a sp name "dbo.helloWorld"
> How can I get the it's name "helloWorld" in the sp?
>
> Thank you.
>

AddThis Social Bookmark Button