Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

Here ya go, just typed this up so it may not be 100%:

select [text] from syscomments where id in
(
select id from sysobjects 
where xtype = 'tr' -- trigger
and parent_obj = 
(
	select id from sysobjects where name = 'TableOfInterest' and xtype = 'u' -- user table
)
)

 

The inner select uses sysobjects to get the id of the table you're interested in.

The next select uses sysobjects again, to get the triggers for that table (using parent_obj).

The outer select gets the text.

 

If you've turned on the SQL Server option to hide the text, you're out of luck. SQL can be made to only store the compiled objects.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...