--写一个函数
create function chks(@f1 varchar(10))
returns bit
as
begin
if (select count(*) from t1 where f1=@f1)>3
return 1
return 0
end
--建表
create table t1(id int identity(1,1),
f1 varchar(10)
constraint aa check(dbo.chks(f1)=0))
create function chks(@f1 varchar(10))
returns bit
as
begin
if (select count(*) from t1 where f1=@f1)>3
return 1
return 0
end
--建表
create table t1(id int identity(1,1),
f1 varchar(10)
constraint aa check(dbo.chks(f1)=0))
on tablename
for insert,update
as
if if (select count(*) from t1 where f1=@f1)>3
raiseerror''思路是这样,不过格式,语法不太清楚了,呵呵
if (select count(*) from t1 where f1=@f1)>3