Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with using iif function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-01-07 : 08:59:21
tal writes "I saw in SqlServer Help the iif() function.
When i try to use this sql :

select iif(dateCol=getdate(),1,0) from DatesTbl

i get an error :
incorrect syntax near '='.

why ?

where is my sin ?

thank you,
tal"

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-07 : 09:08:38
there is no iif in sql server. there's case:

select case when dateCol=getdate() then 1 else 0 end
from DatesTbl


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -