0

以下 Query 的实际结果为 NULL

select semid from programvariantterm where programvariantid = 240

但是当我尝试以下语句时,它给出了 0 行:

declare @semid int
set @semid = -1
select semid from programvariantterm 
where programvariantid = 240 and semid = nullif(@semid,-1)
4

1 回答 1

2

我觉得你有点NULLIF困惑。ISNULL

您的声明将适用于以下内容ISNULL

where programvariantid = 240 and @semid = ISNULL(semid,-1)
于 2012-09-07T15:46:58.320 回答