Solved

writing a basic trigger in SQL 2005

Posted on 2011-02-21
3
217 Views
Last Modified: 2012-05-11
I would like to create a trigger in a SQL 2005 database to run a table update script that I have created.  I would like the trigger to execute my update script whenever data is inserted or updated into the table.  It should not be very complicated.

Could someone please share with me the syntax on how to create such a trigger?  I'd be grateful.
0
Comment
Question by:apitech
3 Comments
 
LVL 8

Accepted Solution

by:
rushShah earned 500 total points
ID: 34944096
try this.


CREATE TRIGGER reminder1
ON Sales.Customer
AFTER INSERT, UPDATE 
AS 
--Execute Your Update Script
GO

Open in new window

0
 
LVL 9

Expert Comment

by:meko72
ID: 34944105
Here is some links I found that might help you.

http://msdn.microsoft.com/en-us/library/ms189799.aspx

http://msdn.microsoft.com/en-us/library/ms190273.aspx

http://ss64.com/sql/   ( 2005 Sql Commands A-Z)

Hope this helpds
0
 
LVL 4

Expert Comment

by:rocky_lotus_newbie
ID: 34944114
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql Audit table 3 67
T-SQL to Update Table Dynamically 2 47
Upgrading SQL 2005 Express to 2008 R2 Express 31 94
Insert from Stored Procedure where some field/s > 0 7 45
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

809 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