If all records already in the table comply with that restriction, one option would be adding a <a href="http://msdn.microsoft.com/en-us/library/ms188258(SQL.90).aspx">CHECK constraint</a> to the table.
Something like this:
<pre>ALTER TABLE yourTable ADD CONSTRAINT ck_yourConstraint
CHECK (col1+col2+col3+col4+col5=100);</pre>
If NULLs are allowed on those columns, you might want to do something like this:
<pre>ALTER TABLE yourTable ADD CONSTRAINT ck_yourConstraint
CHECK (ISNULL(col1,0)+ISNULL(col2,0)+ISNULL(col3,0)+ISNULL(col4,0)+ISNULL(col5,0)=100);</pre>
-CarlosDL
----------------------
Last Wiki Answer Submitted: March 27, 2010 12:27 am by carlosdl63,535 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.