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 |
|
cwildeman
Starting Member
40 Posts |
Posted - 2010-10-27 : 10:24:40
|
| Hi,I am attempting to migrate my MS Access queries to SQL Server which I am new to. Below is part of an Access SQL Statement where I am creating a field called 'Wound' and assigning it a 1 if the field [Wound #1] is Yes. I have tried to convert this to SQL Server and do the same thing but get the following error message:Msg 207, Level 16, State 1, Line 2Invalid column name 'ReturnIfTrue'.Msg 207, Level 16, State 1, Line 2Invalid column name 'returnIfFalse'.Access SQL:HAPU.[Encounter Facility], IIf([Wound #1]="Yes",1,0) AS WoundSQL Server SQL:Case when [Wound #1]='yes' then ReturnIfTrue else returnIfFalse END AS WoundCan someone help?Thanks,Chuck W |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-27 : 10:47:24
|
What should be the value of column Wound? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
cwildeman
Starting Member
40 Posts |
Posted - 2010-10-27 : 10:53:58
|
| Wound should equal 1 if there is a Yes and 0 is it is no.Chuck W |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-27 : 11:02:54
|
Case when [Wound #1]='yes' then '1' else '0' END AS Wound No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
cwildeman
Starting Member
40 Posts |
Posted - 2010-10-27 : 11:20:01
|
| Thanks that solved it. ChuckChuck W |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-10-27 : 11:33:46
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|