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 |
|
santana
Yak Posting Veteran
72 Posts |
Posted - 2009-10-27 : 09:49:02
|
| Hi,I would like to know, If there is in the SQL Server, one function that works as IF function?For example:selectIf (tableA.field1 <> tableB.filed1), then 0 else is (tableB.field1 <> tableC.field1) then 1 else 2.from tableA, tableB, tableCCould you help me, please??Thank you!Regards, |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-27 : 09:55:18
|
| selectcase when (tableA.field1 <> tableB.filed1) then 0 when (tableB.field1 <> tableC.field1) then 1 else 2 endfrom tableA, tableB, tableCMadhivananFailing to plan is Planning to fail |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-10-27 : 09:55:24
|
| Use Caseselectcase when (tableA.field1 <> tableB.filed1) then 0when (tableB.field1 <> tableC.field1) then 1 else 2 end as column_namefrom tableA, tableB, tableCSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
|
|
|