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 |
|
eugz
Posting Yak Master
210 Posts |
Posted - 2012-05-11 : 11:52:09
|
| Hi All.I have two fields StartDate and EndDate and I would like to make base on them value new column "Filter". What I mean. If StartDate is not null and EndDate is null then column "Filter" get value Active. If EndDate is not null then column "Filter" get value Inactive. If it is possible how it to do?Thanks. |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-05-11 : 12:18:39
|
| [code]SELECT StartDate, EndDate, CASE WHEN StartDate IS NOT NULL AND EndDate IS NULL THEN 'Active' ELSE Inactive END AS FilterFROM YourTable[/code] |
 |
|
|
eugz
Posting Yak Master
210 Posts |
Posted - 2012-05-11 : 12:49:12
|
| Hi sunitabeck. Thanks for replay. |
 |
|
|
|
|
|