Solved

How to check triggers and edit them

Posted on 2006-11-23
8
337 Views
Last Modified: 2011-10-03
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
0
Comment
Question by:Richards
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18001669
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...
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18001677
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
0
 

Author Comment

by:Richards
ID: 18001689
I am using sql server 2000
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18001699
both of the above posts are for SQL server 2000
0
 

Author Comment

by:Richards
ID: 18002115
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
*/


0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 125 total points
ID: 18002175
replace  "CREATE  " with  " ALTER " 



ALTER  TRIGGER trgName
ON tableName  
AFTER insert, update  
 
AS  

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

0
 

Author Comment

by:Richards
ID: 18002184
do I need to commit
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18002194
no.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question