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.
Author |
Topic |
brimes
Starting Member
3 Posts |
Posted - 2009-02-06 : 08:46:44
|
I'm getting an error with:Select IIf([status]="Open" And [GoalMet]=True,1,0) AS Open_Met ...Error is: "ADO Syntax, error near '='I'm an Access developer moving into SQL Server. This syntax is perfectly legal in Access.Is the IIf function and any type of equal sign not allowed in views?Also, I'm find that the view is changing:[status]="Open"to[status]=[Open]Not sure why that is happening. Are double quotes not allowed? (single quotes didn't work either) Is 'Open' a reserved word?I know a workaround would be creating a function to do this but wonder if there an easier way. Thanks for any help. |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-06 : 08:55:10
|
IIF is not a recognised sql keyword. Use CASE instead. |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-06 : 08:59:34
|
something like,select (case when [status]='Open' And [GoalMet]=True then 1 else 0 end) as Open_Met ... |
|
|
brimes
Starting Member
3 Posts |
Posted - 2009-02-06 : 09:55:16
|
Yes, that works. Thanks! |
|
|
|
|
|