Re: Can FK be nullable/optional by design?
Date: Wed, 17 Dec 2003 16:32:04 -0600
Message-ID: <eIq0Z2OxDHA.1484_at_TK2MSFTNGP09.phx.gbl>
"Tobes (Breath)" <tobin_dont_spam_me_at_breathemail.net> wrote in message news:brq3iu$5nfbc$1_at_ID-131901.news.uni-berlin.de...
> Hmmm, I thought Data Types (including UDTs) did enforce business rules, by
> constraining the set of possible values that can be stored in a column
> constrained to that type. If a business rule dictates that data of a
certain
> type must fall within a spefic range, for example, then by defining a type
> that imposes this constraint, the business rule could be enforced by the
> Data Type?
>
The type of data type chosen is the first step in enforcing business rules. Clearly if the business rule states this will be an integer between -100 and 100, then you first choose a datatype. In this case, you might go with a smallint, or just an integer. Then you apply a check constraint. A proper Domain or a User Defined Type will include the datatype and some of the checking needed. If you chose a varchar for instance, the user would be able to insert whatever into the column, unless you built more elaborate checking into your column.
-- ---------------------------------------------------------------------------- ----------- Louis Davidson (drsql_at_hotmail.com) Compass Technology Management Pro SQL Server 2000 Database Design http://www.apress.com/book/bookDisplay.html?bID=266 Note: Please reply to the newsgroups only unless you are interested in consulting services. All other replies will be ignored :)Received on Wed Dec 17 2003 - 23:32:04 CET