70 likes | 197 Views
Good Afternoon. RULES. Rule is an object, when bound to a column, specifies the acceptable values that can be inserted into that column. Syntax: create rule < r ulename > as <condition> Ex: create rule r1 as @r<=10 To bind a rule to a column.
E N D
RULES Rule is an object, when bound to a column, specifies the acceptable values that can be inserted into that column. Syntax: create rule <rulename> as <condition> Ex: create rule r1 as @r<=10 To bind a rule to a column. Syntax: sp_bindrule <rulename>, <tbname.colname> Ex: sp_bindrule ‘r1’,student.roll
UNBIND RULE We can remove a rule from an existing column. Syntax: sp_unbindrule <tablename.columnname> Ex: sp_unbindrule ‘student.roll’
View Create a virtual table that represents the data in one or more tables in an alternative way. Synatx: CREATE VIEW <Viewname> AS < Select Statement> Ex: Create view v1 as select roll, name from student where mark>40
Alter View Alter a virtual table that represents the data in one or more tables in an alternative way. Synatx: ALTER VIEW <Viewname> AS < Select Statement> Ex: Alter view v1 as select roll, name from student where mark<=50 and mark>=40
Drop View Removes one or more views from the current database. Syntax: Drop view <view name> Ex: Drop view v1