ms access - Migrate from IIF to CASE statements in SQL Server 2008 R2 -


i have requirement have migrate ms access sql server.

we have clause :

where (((iif([attd_region_cd]='all',true,iif([attd_region_cd]='ni' ,     [region_cd]<>'002' , [region_cd]<>'007',true,iif([attd_region_cd]= [region_cd],true,false))))<>false) 

now have use sql server case statement instead of iif in query following:

where (     case         when qryrpt_posendtasks_tasks.attd_region_cd = 'all'         @out = true         else (case      when (qryrpt_posendtasks_tasks.attd_region_cd='ni'  , qryrpt_posendtasks_vendorregion.region_cd<>'002'  , qryrpt_posendtasks_vendorregion.region_cd<>'007'  @out=true  else ( case when qryrpt_posendtasks_tasks.attd_region_cd     =qryrpt_posendtasks_vendorregion.region_cd  @out= true  else @out=false  end  )  

end ) end <>false)

i have declare @out bit.

now after executing query error:

incorrect syntax near '='.

i have check result of case statement if true or false.

please me regarding this.

thanks in advance

doesn't seem need case expression - logic:

where [attd_region_cd]='all' or ([attd_region_cd]='ni' , [region_cd] not in ('002','007')) or ([attd_region_cd]=[region_cd]) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -