22,209
社区成员
发帖
与我相关
我的任务
分享
create table test(id int, name varchar(10))
go
CREATE RULE ARule AS @A BETWEEN 0 AND 50000
go
EXEC sp_bindrule 'ARule', 'test.id'
go
select object_name(object_id) oname ,
name, column_id, object_name(rule_object_id) rule_name
from sys.columns where object_id = object_id('test')
go
drop table test
go
drop RULE ARule
go
已将规则绑定到表的列。
oname name column_id rule_name
----------------------- ------------- ----------- ------------
test id 1 ARule
test name 2 NULL
(2 行受影响)