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 |
|
sgrahman
Starting Member
10 Posts |
Posted - 2007-07-26 : 12:57:36
|
| I was able to do the following in MS Access using IIF function. T-SQL does not support IIF so I am stuck. Please help.I have field1, field2 and field3I want to write a IF and Else statement like below in T-SQL or is there anyway to write this in SQL 2005:IF (field1=field2 and field2=field3 and field1=field3) then 1 else 0 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-07-26 : 13:00:38
|
| CASE WHEN (field1=field2 and field2=field3 and field1=field3) then 1 else 0 ENDDinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
sgrahman
Starting Member
10 Posts |
Posted - 2007-07-26 : 14:23:21
|
| I used case statement by Dinakar and it worked fine. Thanks.Also thanks to JSMith8858 for your post. |
 |
|
|
|
|
|