create function f_check
(
@str1 varchar(100),
@str2 varchar(100)
)
returns varchar(10)
as
begin
declare @i int
set @i=0 while @i<=9
begin
if charindex(convert(varchar,@i),@str1)>0
and
charindex(convert(varchar,@i),@str2)>0
return 'false' set @i=@i+1
end return 'true'
end
go--测试
declare @str1 varchar(100)
,@str2 varchar(100)
select @str1='12345'
,@str2='6789'
select dbo.f_check(@str1,@str2)--结果
/*
----------
true(1 row(s) affected)
*/
(
@str1 varchar(100),
@str2 varchar(100)
)
returns varchar(10)
as
begin
declare @i int
set @i=0 while @i<=9
begin
if charindex(convert(varchar,@i),@str1)>0
and
charindex(convert(varchar,@i),@str2)>0
return 'false' set @i=@i+1
end return 'true'
end
go--测试
declare @str1 varchar(100)
,@str2 varchar(100)
select @str1='12345'
,@str2='6789'
select dbo.f_check(@str1,@str2)--结果
/*
----------
true(1 row(s) affected)
*/
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货