Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-06-24 : 07:28:24
|
| Aaron writes "Is it possible to dynamically determine the name of a stored procedure from within that same stored procedure. While I know it isn't correct, this is what I am looking for:---------begin dream proc----------create proc myproc_DoSomething@value intAS--This is the problem, getting the procname.EXEC audit_proc @@ProcName...the rest of the procedure.---------end dream proc----------The @@ProcName should be some system function that would return the currently running procname, in this case "myproc_DoSomething"Any ideas?Aaron" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-06-24 : 07:32:40
|
| have a look at @@procid....you may be able to use the value returned to determine the procedure name when using the information_schema views..... |
 |
|
|
Wanderer
Master Smack Fu Yak Hacker
1168 Posts |
Posted - 2004-06-24 : 07:34:40
|
| drop proc testproceduregoCREATE PROCEDURE testprocedure ASselect object_name(@@procid) AS 'ProcID'GOEXEC testprocedureGOhows that?*##* *##* *##* *##* Chaos, Disorder and Panic ... my work is done here! |
 |
|
|
headyan
Starting Member
2 Posts |
Posted - 2004-06-24 : 07:47:05
|
| Thanks all. As soon as I saw the @@procid it all became so clear.... |
 |
|
|
|
|
|