Create Rules In SQL

A rule in SQL is used to specify a restriction on the values for a column or a user defined value.

There are two statements which we are used in Rules:
:- CREATE RULE
:- DROP RULE

Syntax of CREATE RULE:

CREATE RULE rule_name as Conditional_Expression

Here rule_name is the name of the Rule and Conditional_Expression is the condition that defines the Rule.

CREATE RULE countryname as @countryname IN ('India','USA');


DROP RULE is used when we want to drop the RULE

Ex:

DROP RULE countryname
Next Recommended Reading How to Create Function in SQL Server