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
 Transact-SQL (2000)
 Working of IIF function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-07 : 11:30:24
Jagjit writes "select iif(datediff(day,'02-may-2004',getdate()) > 1 ,1,0) as diff

The above statement gives me error

Error Description:
(Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '>'.
)

Please explain how to rectify this error."

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-05-07 : 11:33:38
try

case when datediff(day,'02-may-2004',getdate()) > 1 then 1
else 0
end as diff

might work :))

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

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-05-07 : 12:47:25
IIF is an access (or excel) function not supported in SQL Server. CASE will work for you. You can find information and examples in Books Online.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -