SQL Server Data Validation / Data Entry
I am considering adding validation to some insert and update statements for MS SQL Server 2005. I want to be able to validate values ββinserted before they are written to the table - in this particular case, it is a whole field where the data must match the rule. So a simple circuit could be:
([id] [int] identity(1,1), [name] [nvarchar], [magicvalue] [int])
And the magicvalue is the one I'm going to check. However, this is a common "best practice" question when indexes and foreign key constraints are not appropriate. I guess I'm not sure if triggers or constraints are the appropriate way or if there are other ways.
An example is optional :)
0
source to share
2 answers