guest2013-1
guest
- Joined
- Aug 22, 2003
- Messages
- 19,800
- Reaction score
- 13
I'm playing around with triggers and I want to know if there's way for me to get the table structure of inserted/deleted table?
Something like:
Or is there a way for me to get the name of the table the trigger is firing on so I can do that anyway?
Something like:
Code:
select c.name '@column', t.name '@type', c.max_length '@length' from sys.table_types as tt join sys.columns as c on tt.type_table_object_id = c.object_id join sys.types t on t.system_type_id = c.system_type_id and t.user_type_id = c.user_type_id and tt.type_table_object_id = c.object_id where tt.name = 'mytable' FOR XML PATH('table'), ROOT('table_structure')
Or is there a way for me to get the name of the table the trigger is firing on so I can do that anyway?