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 |
|
MGA
Starting Member
28 Posts |
Posted - 2010-04-16 : 03:50:23
|
hi all;i have a table named Periods has the following columns:Period_Id int,Period_Start_Date,Period_End_Date,Closed bit default('false')i want to select the data in the table Periodsbut i want the data in the column Closed take the values:'Not Closed' if it = 0 'Has been Closed' if it = 1Exampleif the table data isPeriod_Id Period_Start_Date Period_End_Date Closed 1 1/5/2010 31/5/2010 0 2 1/6/2010 30/6/2010 1i want to select them in the formPeriod_Id Period_Start_Date Period_End_Date Closed 1 1/5/2010 31/5/2010 Not Closed 2 1/6/2010 30/6/2010 Has been Closed Regards |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-04-16 : 03:55:21
|
| [code]select period,Period_Start_Date,Period_End_Date, case Closed when 1 then 'Has been Closed' else 'Not Closed' end as Closed from Periods[/code]you can get more info on case statements herehttp://msdn.microsoft.com/en-us/library/ms181765.aspxPBUH |
 |
|
|
|
|
|