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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger preventing table deletes 1

Status
Not open for further replies.

Luzian

Programmer
Nov 27, 2005
103
US
I need a trigger to prevent deletion of any rows on all tables except for those I specify.
 
Put a column in your table that is called ReadOnly or something to that effect. Make is a bit data type. If it's not deleteable set ReadOnly to 1.

Have a trigger on the table setup that checks the max value of the ReadOnly field in the deleted column. If the value is 1 issue a rollback command.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005) / MCITP Database Administrator (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