Friday, February 24, 2012

Help

Can someone tell me what's the equivalent of this access code in sql:
IIf([item_no] In ("MISDEF","MISDES"),[invdiv],[moddiv]) AS ModDivX
It is in the select statement.something like this?

declare @.item_no varchar(10)
set @.item_no = 'MISDEF'
select case when @.item_no in ('MISDEF','MISDES') then 'invdiv' else 'moddiv' end as ModDivX
set @.item_no = 'MISDES'
select case when @.item_no in ('MISDEF','MISDES') then 'invdiv' else 'moddiv' end as ModDivX
set @.item_no = 'spud'
select case when @.item_no in ('MISDEF','MISDES') then 'invdiv' else 'moddiv' end as ModDivX

No comments:

Post a Comment