SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Training
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
SQL Azure
Developer
General DBA
ASP.NET / ADO.NET
SQL Azure

USEFUL SITES :

ASP.NET Tutorials
Windows and SQL Azure Tutorials
Cloud Hosting Magazine
SharePoint Tutorials
Windows Server Help

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server

More     
 
Latest FAQ's

Add Node to A SQL Server failover Cluster failed with invalid ...
SQL Server Destination remote server error
Setting Up Data And Log Files For SQL Server
Will Check Constraints Improve Database Performance?

More     
   
Latest Software Reviews

dbForge Review
Spotlight on ApexSQL Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Data Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Doc 2008

More     

articles >> developer >> Implementing Triggers in SQL Server 2000 ...

Implementing Triggers in SQL Server 2000

By : Navneeth Diwaker Naik
Aug 31, 2004

Triggers are special types of Stored Procedures that are defined to execute automatically in place of or after data modifications. They can be executed automatically on the INSERT, DELETE and UPDATE triggering actions.

There are two different types of triggers in Microsoft SQL Server 2000. They are INSTEAD OF triggers and AFTER triggers. These triggers differ from each other in terms of their purpose and when they are fired. In this article we shall discuss each type of trigger.

First of all, let's create a sample database with some tables and insert some sample data in those tables using the script below:

 

Create Database KDMNN

GO

 

USE KDMNN

GO

 

CREATE TABLE [dbo].[User_Details] (

             [UserID] [int] NULL ,

             [FName] [varchar] (50) NOT NULL ,

             [MName] [varchar] (50) NULL ,

             [LName] [varchar] (50) NOT NULL ,

             [Email] [varchar] (50)  NOT NULL

) ON [PRIMARY]

GO

 

CREATE TABLE [dbo].[User_Master] (

             [UserID] [int] IDENTITY (1, 1) NOT NULL ,

             [UserName] [varchar] (50) NULL ,

             [Password] [varchar] (50) NULL

) ON [PRIMARY]

GO

 

ALTER TABLE [dbo].[User_Master] WITH NOCHECK ADD

             CONSTRAINT [PK_User_Master] PRIMARY KEY  CLUSTERED

             (

                           [UserID]

             )  ON [PRIMARY]

GO

 

ALTER TABLE [dbo].[User_Details] ADD

             CONSTRAINT [FK_User_Details_User_Master] FOREIGN KEY

             (

                           [UserID]

             ) REFERENCES [dbo].[User_Master] (

                           [UserID]

             )

GO

 

INSERT INTO USER_MASTER(USERNAME, PASSWORD)

             SELECT 'Navneeth','Navneeth' UNION

             SELECT 'Amol','Amol' UNION

             SELECT 'Anil','Anil' UNION

             SELECT 'Murthy','Murthy'

 

INSERT INTO USER_DETAILS(USERID, FNAME, LNAME, EMAIL)

             SELECT 1,'Navneeth','Naik','navneeth@kdmnn.com' UNION

             SELECT 2,'Amol','Kulkarni','amol@kdmnn.com' UNION

             SELECT 3,'Anil','Bahirat','anil@kdmnn.com' UNION

             SELECT 4,'Murthy','Belluri','murthy@kdmnn.com'


    Next Page>>    








C# Help and Tutorials | PHP MySQL Tutorial | Sharepoint Tutorial | Azure Tutorial | Cloud Hosting Magazine | ASP.NET Tutorials | Windows Server Help | Windows Phone Pro | Silverlight Ace | Visual Studio Tutorials | Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | SQL Server Training Videos | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 2010 Jude O'Kelly. All rights reserved