Hi,
I would assume most columns in a db would have a known valid range of values
that it makes sense for the business logics. For example, most counting
columns shouldn't have negative value even though it makes some mathetical
sense but high level application code typically doesn't handle it well. So
I'm wondering if experienced db designers would think it's worth adding a
huge check constraint to make sure all values entered into the table are
within the valid (or expected) range. thank you very much.
I'm a great fan of CHECK constraints!
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Zeng" <Zeng5000@.hotmail.com> wrote in message news:%23BEpd4AfFHA.640@.tk2msftngp13.phx.gbl...
> Hi,
> I would assume most columns in a db would have a known valid range of values
> that it makes sense for the business logics. For example, most counting
> columns shouldn't have negative value even though it makes some mathetical
> sense but high level application code typically doesn't handle it well. So
> I'm wondering if experienced db designers would think it's worth adding a
> huge check constraint to make sure all values entered into the table are
> within the valid (or expected) range. thank you very much.
>
|||Just like Tibor, I am a great fan of Check constraints and use them
generously. However you can probably overdo anything...The reason I use so
many check constraints is that it protects the database against faulty code,
and users who bypass the application using Excel, QA, SEM or any of the
other tools easily obtainable.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Zeng" <Zeng5000@.hotmail.com> wrote in message
news:%23BEpd4AfFHA.640@.tk2msftngp13.phx.gbl...
> Hi,
> I would assume most columns in a db would have a known valid range of
> values
> that it makes sense for the business logics. For example, most counting
> columns shouldn't have negative value even though it makes some mathetical
> sense but high level application code typically doesn't handle it well.
> So
> I'm wondering if experienced db designers would think it's worth adding a
> huge check constraint to make sure all values entered into the table are
> within the valid (or expected) range. thank you very much.
>
|||is there any advantage of having one for each isolated column in a table or
a huge one per table (with the use of AND and OR operator)?
Thanks!
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:uKtOgJCfFHA.3448@.TK2MSFTNGP12.phx.gbl...
> Just like Tibor, I am a great fan of Check constraints and use them
> generously. However you can probably overdo anything...The reason I use so
> many check constraints is that it protects the database against faulty
code,[vbcol=seagreen]
> and users who bypass the application using Excel, QA, SEM or any of the
> other tools easily obtainable.
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Zeng" <Zeng5000@.hotmail.com> wrote in message
> news:%23BEpd4AfFHA.640@.tk2msftngp13.phx.gbl...
mathetical[vbcol=seagreen]
a
>
No comments:
Post a Comment