-- Use the code snippet below to determine what table the trigger belongs to:
-- Declare as varchar(30) in SQL60/65
-- How it works?
/*
 The @@PROCID system function gives the id of the stored procedure or trigger that is executing.
 We use the id to locate the trigger row in sysobjects. The 'parent_obj' column for a trigger
 contains the table to which it belongs.
*/
declare @tablename nvarchar(128)
select @tablename = object_name(parent_obj) from sysobjects where id = @@procid
This page was last updated on May 01, 2006 04:28 PM.