Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use Triggers to prevent changes

Status
Not open for further replies.

edsargent

Programmer
Feb 16, 2005
2
US
How can a trigger be used to prevent updates or deletions of records based on the value of a column.
 
There are two temporary tables created when a trigger files. One contains the old values and the other contains the new values. You can compare the values in the table containing the old values and if there is something disagreeable about that data - roll it back.
Perhaps this link will help - though this appears to be sybase but it looks identical to SQL Server to me.

 
Basically what it comes down to is if you put a rollback command in the trigger the calling command is also rolled back.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top