How to convert or rewrite Access IIF Statement in SQL Server -


i thought iif statements returns 1 value if condtion true or false iif statement in access returns field , values.

iif([a1]![kpr],[a1]![kat],iif([data2]![kat],[data2]![kat],[data1]![kat])), 

the table left join in clause i'm try realize statement in sql server using case when accepts true or false condition.

how can understand , realize statement.

iif function in vb, vba, , access same ps_prakash02 wrote in comment: iif(condition, value_if_true, value_if_false). means if condition evaluates true, value_if_true returned, otherwise value_if_false returns.
translation of iif t-sql case when condition value_if_true else _value_if_false end.

i'm not sure [a1]![kpr] means in access, i'm guessing it's kpr column value of table a1 or this, i'll leave them in question , replace iif case in answer:

case when [a1]![kpr] [a1]![kat]      else           case when [data2]![kat] [data2]![kat]                else [data1]![kat]          end  end 

note: in sql server 2012 microsoft included iif in t-sql.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -