Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #834
| From | Erland Sommarskog <esquel@sommarskog.se> |
|---|---|
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Re: Get trigger name inside trigger (reflection) |
| Date | 2011-11-24 08:14 +0000 |
| Organization | Erland Sommarskog |
| Message-ID | <Xns9FA75E06E4F8AYazorman@127.0.0.1> (permalink) |
| References | <e726eebf-685d-419d-90ce-39bbee3fe9c4@da3g2000vbb.googlegroups.com> |
Necoc Yaotl (tezcatlipoca1427@gmail.com) writes: > Inside a trigger, is there a way to get the name of that trigger? (in > SQL Server 2000). > > Something like: > > create trigger my_trigger on my_table for update > as > > declare @current_trigger_name varchar(100) > > select @current_trigger_name = some_function() You can use @@procid which returns the object id for the currently runnnig module which you can pass as a parameter. You can then use the function object_name() to get the name of the trigger. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
Get trigger name inside trigger (reflection) Necoc Yaotl <tezcatlipoca1427@gmail.com> - 2011-11-23 20:32 -0800
Re: Get trigger name inside trigger (reflection) Erland Sommarskog <esquel@sommarskog.se> - 2011-11-24 08:14 +0000
Re: Get trigger name inside trigger (reflection) Necoc Yaotl <tezcatlipoca1427@gmail.com> - 2011-11-24 18:04 -0800
csiph-web