原来Transact-SQL可以这样写:


declare @i int;
set @i = 0;
if @i in(1,2,3,4)
select 'OK';
else
select 'oh god';

结果显示: oh god.

 

这说明,不用写成 if @i=1 OR @i=2 OR ... 这么蠢。