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

Training Videos

Check out our new SQL Server Training Videos section More...

Write for Us

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

50 Tips to Boost Performance of an ASP.NET Application - ...
50 Tips to Boost Performance of an ASP.NET Application - ...
Understanding WCF Hosting
SQL Server Logical Reads – What do they really tell us? ...

More     
 
Latest FAQ's

Will Check Constraints Improve Database Performance?
The Excel Connection Manager is not supported in the 64-bit version ...
Is there a difference between fill factor 0 and 100 ...
An ASP.NET setting has been detected that does not apply in ...

More     
   
Latest Software Reviews

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

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 | 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 | QDPMA Performance Tuning | 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