zoukankan      html  css  js  c++  java
  • Rules 數據的規則

    A. Rule with a range
    This example creates a rule that restricts the range of integers inserted into the column(s) to which this rule is bound.

    CREATE RULE range_rule
    AS
    @range >= $1000 AND @range < $20000

    B. Rule with a list
    This example creates a rule that restricts the actual values entered into the column or columns (to which this rule is bound) to only those listed in the rule.

    CREATE RULE list_rule
    AS
    @list IN ('1389', '0736', '0877')

    C. Rule with a pattern
    This example creates a rule to follow a pattern of any two characters followed by a hyphen, any number of characters (or no characters), and ending with an integer from 0 through 9.

    CREATE RULE pattern_rule
    AS
    @value LIKE '_ _-%[0-9]'

    Examples
    This example unbinds and then drops the rule named pub_id_rule.

    USE pubs
    IF EXISTS (SELECT name FROM sysobjects
             WHERE name = 'pub_id_rule'
                AND type = 'R')
       BEGIN
          EXEC sp_unbindrule 'publishers.pub_id'
          DROP RULE pub_id_rule
       END
    GO


    CREATE RULE id_chk AS @id BETWEEN 0 and 10000
    GO
    CREATE TABLE cust_sample
       (
       cust_id            int
       PRIMARY KEY,
       cust_name         char(50),
       cust_address         char(50),
       cust_credit_limit   money,
       )
    GO
    sp_bindrule id_chk, 'cust_sample.cust_id'
    GO

     

    申明

    非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!

    博文欢迎转载,但请给出原文连接。

  • 相关阅读:
    rest framework 之前
    python之psutil
    可持久化并查集总结
    复数学习
    主席树总结
    点分治题单(来自XZY)
    Tarjan&2-SAT 总结
    AC自动机题单
    网络流题目详讲+题单(入门版)(持续更新中......)
    网络流题目详讲+题单(提高版)(持续更新中......)
  • 原文地址:https://www.cnblogs.com/Athrun/p/831524.html
Copyright © 2011-2022 走看看