Solved

How to check triggers and edit them

Posted on 2006-11-23
8
340 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

623 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