Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:

How to protect of integrity of data in sql server by triggers.

please send  an example  for  me.

thanks.

Posted
Updated 27-Nov-09 11:53am
v2

Sql server Triggers are not generally used to protect integrity of data. It is actually a place to control the operation.

But if you really want to use Triggers for this, you might check the value inside that block before doing the insert.

Implementing Triggers is very simple. Use this tutorial to get started :
http://www.devarticles.com/c/a/SQL-Server/Using-Triggers-In-MS-SQL-Server/1/[^]

:rose:
 
Share this answer
 
The best way to protect your data is with constraints, but if you mean, for example, making sure a string is a given format, a trigger can fire when you insert data, and can check it and accept or reject the insert.  You can have triggers for updates and deletes, too.  Any example I write will not be as in depth as the many you can find with google, in articles that were written with more care than any forum reply.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900