Link to home
Start Free TrialLog in
Avatar of Richards
Richards

asked on

How to check triggers and edit them

Hi

I have 3 trigger which have to be updated. I can see then when
sp_help triggername.

How do I  view edit delete them
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Using Enterprise Manager (SQL Server 2000 or lower), you go to the table, right-click, All Tasks->Manage Triggers.
the form opens and show the defaul "new trigger".
in the combo box however you will find the other triggers, select them, and the code will appear in the code box...
Using Query analyser, u can run the procedure

exec sp_helpText 'urTriggerName'


copy the result and paste it in another window, change "CREATE' to 'ALTER'  do ur modifications, run it



Method2

Use QA -> Press F8 -> expand ur table -> triggers
right click on the trigger and select edit the contents in a new window
Avatar of Richards
Richards

ASKER

I am using sql server 2000
both of the above posts are for SQL server 2000
Thanks when I change some SQL s inside the trigger and run it I am getting the below error. Do I need to drop and create it ?

Server: Msg 2714, Level 16, State 5, Procedure  trgName, Line 65535
There is already an object named 'trgName' in the database.



 CREATE  TRIGGER trgName
ON tableName  
AFTER insert, update  
 
AS  

 DECLARE @var int  
.
.
.
/*
Commented some sqls
*/


ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

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
do I need to commit