I have access query and I am converting it to SQL Server 2008R2. I'm looking for the equivalent to the Access IIF statement in SQL Server. Below is the statement I am trying to convert; ("select IIF(MAX(bill_bno) IS NULL,1,MAX(bill_bno)+1) from rec_all where rw=0 and iif(month(bill_date)>=1 AND month(bill_date)<=3,year(bill_date)-1,year(bill_date))=" & IIf(Month(Date) >= 1 And Month(Date) <= 3, Year(Date) - 1, Year(Date))) |
Loading

Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 23, 2017, 8:57 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 23, 2017, 9:28 PM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 23, 2017, 8:59 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 23, 2017, 9:02 PM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 23, 2017, 9:15 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 23, 2017, 9:17 PM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 23, 2017, 9:34 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 23, 2017, 9:57 PM EST
Rafnas T PRank #280 · 8.8K reputationPosted Feb 23, 2017, 11:23 PM EST
iif(month(bill_date)>=1 AND month(bill_date)<=3,year(bill_date)-1,year(bill_date))='' and
IIf(Month(Date) >= 1 And Month(Date) <= 3, Year(Date) - 1, Year(Date))='')
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 24, 2017, 12:50 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 24, 2017, 1:51 AM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 25, 2017, 1:45 AM EST
Jitendra ShekhawatRank #1,909 · 772 reputationPosted Feb 25, 2017, 1:48 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Feb 25, 2017, 2:07 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts