Link to home
Start Free TrialLog in
Avatar of vielkacarolina1239
vielkacarolina1239Flag for United States of America

asked on

How can I view the code on a trigger?

Lest asume that I have used the following syntax to find the name of a trigger in Computers DB and  I need to modify it.
Select * From [Computers].dbo.sysobjects Where xtype = 'TR'

Also, asume that I don't know were the code file resides for the trigger.

How can I get to view the code on this trigger? Is there a sql syntax for this?

I am using SQL Server Express.
Avatar of Martin-Smith
Martin-Smith

sp_help 'triggername'
SOLUTION
Avatar of Martin-Smith
Martin-Smith

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vielkacarolina1239

ASKER


I ran the syntax:  sp_help 'myTrgger'

The Result pane returns the Name of the trigger, Woner, Type, Create_Date.

However, I need to see the code on this trigger. When I run the above syntax, is there a pane I need to open to view and alter the code on this trigger?

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I told you wrong . bungHoc got it right with sp_helptext
Thanks guys, you are great. Both solutions work. buhgHoc solution is a little cleaner than marting. But, both work.