我有一个参数
@IsInRetry
如果是假,我必须将where条件设置为
attempts = 0
如果确实如此,我必须将where条件设置为
attempts > 0
怎么可以这样做?
答案 0 :(得分:4)
尝试这种方式:
( (@IsInRetry = 0 and attempts = 0) or (@IsInRetry = 1 and attempts > 0) )
答案 1 :(得分:0)
试试这个:
WHERE (attempts = @IsInRetry or (@IsInRetry = 1 and attempts > 0))
答案 2 :(得分:0)
试试这个,也应该用于否定尝试: - )
@IsInRetry = (attempts > 0)
问候。
答案 3 :(得分:-1)
此:
if @IsInRetry = 0x0
BEGIN
SELECT * FROM dbo.tbl
WHERE attempts = 0
END
ELSE
BEGIN
SELECT * FROM dbo.tbl
WHERE attempts = 1
END