declare @cypic varchar if (NULLIF(@cypic, '') IS NOT NULL) begin print 1 end else begin print 2 end
结果是:2
NULLIF方法是把为‘’的变成NULL 然后再判断 IS NOT NULL