|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Create RuleCan you create a rule on more than one column? I want to create a rule for
the following condition, fldname1 != '' OR fldname2 != ''. Is it possible? if so how? Your help will be greatly appreciated. THanks! You may want to use CHECK constraints for this along the lines of :
CHECK ( col_1 <> '' OR col_2 <> '' ) See SQL Server Books Online for exact syntax, examples & usage details of check constraints. -- Anith HP (H*@discussions.microsoft.com) writes:
> Can you create a rule on more than one column? I want to create a rule To add to Anith's response, note that rules defined by CREATE RULE> for the following condition, fldname1 != '' OR fldname2 != ''. Is it > possible? if so how? are deprecated my Microsoft. I disagree a bit there - I think they are excellent for user-defined types. But there is never any reason to bind a rule directly to a column. Instead you should use constraints, as Anith outlined. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx |
|||||||||||||||||||||||