想这样写
declare @a bool = false
declare @b bool = falseif(exists(select * from a where...))
{
做一些操作,并且记录已经查过
@a = true;
}if(exists(select * from b where...))
{
做一些操作,并且记录已经查过
@b = true;
}if(@a且@b)
{
做什么操作
}
发现SQL里没有bool,而用big型也没做逻辑运算,这怎么办
declare @a bool = false
declare @b bool = falseif(exists(select * from a where...))
{
做一些操作,并且记录已经查过
@a = true;
}if(exists(select * from b where...))
{
做一些操作,并且记录已经查过
@b = true;
}if(@a且@b)
{
做什么操作
}
发现SQL里没有bool,而用big型也没做逻辑运算,这怎么办
declare @b bit
set @b=0
select not(@b)
都不行
declare @a bit = 0
declare @b bit = 0if(exists(select * from a where...))
{
做一些操作,并且记录已经查过
@a = 1;
}if(exists(select * from b where...))
{
做一些操作,并且记录已经查过
@b = 1;
}if(@a=1 and @b=1)
{
做什么操作
}--思维转化下