create procedure test @UserNam varchar(100),
@result varchar(100) output
asif exists ( select 1 from table where UserName=@UserNam)
begin
set @result='true'
end
else
begin
set @result='false'
end
go
declare @a varchar(100)exec test 'cl0001',@a outputselect @a
@result varchar(100) output
asif exists ( select 1 from table where UserName=@UserNam)
begin
set @result='true'
end
else
begin
set @result='false'
end
go
declare @a varchar(100)exec test 'cl0001',@a outputselect @a
@exi bit output)
as
set @exi=0
if exists ( select 1 from table where UserName=@UserNam)
set @exi=1
go
declare @e bit
exec exiname 'SearchName',@e output
select @e
@username varchar(100)
as
if exists(select 1 from userinfo where username=@username)
select 1
else
select 2
if exists ( select 1 from table where UserName=@UserName)
print true
else
print false
不知道这样做比exit(select 1 from userinfo where username=@username)
差在什么地方呀?
as
BEGIN
if Exists(Select * from UserInfo where UserName=@cName)
Select "True"
else
Select "False"
END