Results 1 to 4 of 4

Thread: Creating Rule

  1. #1
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270

    Unanswered: Creating Rule

    Hi,
    I want to define different rules for user define datatypes with the following details...

    1. The hotel classification should be an integer between 1 and 5.
    2. Must be a valid two character lowercase
    3. Combined date and time fields should have format 'yyyy-mm-dd hh:mm:ss'.
    4. The id must be a non-negative integer.

  2. #2
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    1, 2 and 4 can be implemented with CHECK constraints.

    DATETIME values don't have a format of any kind so 3 isn't relevant.

  3. #3
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270
    I know, BUt as per the client requirement, it has to be RULES only....

  4. #4
    Join Date
    Dec 2007
    Location
    London, UK
    Posts
    741
    SQL Server rules are a deprecated feature that will be removed from future versions. So your client should consider what their future upgrade strategy will be. If you must use rules then the syntax is documented in Books Online. Do you still have a question?

    CREATE RULE (Transact-SQL)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •