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 |
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2009-05-13 : 14:24:13
|
| The table is called ClearedDiaryFields:doc (varchar(3), null)totmet (int, not null)totclr (int, not null)weekdat (datetime, null)dowrdat (datetime, null)Here's my stored procedure:Select distinct weekdat,cast(DATEPART(m, weekdat) as Varchar(5))+'/'+cast(DATEPART(d, weekdat) as Varchar(5))+'/'+ cast(DATEPART(yy, weekdat) as Varchar(5))as[Week]from dbo.ClearedDiary order by weekdat descI would like to have only the converted column Week returned in the results but I'm getting both columns, Weekdat and Week. Is this possible? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-13 : 14:30:09
|
SELECT CONVERT(VARCHAR(10), WeekDat, 101) AS [Week]FROM dbo.ClearedDiaryGROUP BY CONVERT(VARCHAR(10), WeekDat, 101)ORDER BY WeekDat DESC E 12°55'05.63"N 56°04'39.26" |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2009-05-13 : 14:34:01
|
| Perfect...Thanks! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-13 : 14:36:28
|
You're welcome. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|
|
|