SELECT DISTINCT TOP 100 PERCENT Member_Id,
RTRIM(CAST(DATEPART(yyyy, [Interval]) AS char))
+ '.' + RTRIM(CAST(DATEPART(mm, [Interval]) AS char))
+ '.' + RTRIM(CAST(DATEPART(dd, [Interval]) AS char)) AS Dates,
RTRIM(CAST(DATEPART(hh, [Interval]) AS char))
+ '.' + RTRIM(CAST(DATEPART(mi,[Interval]) AS char))
+ '.' + RTRIM(CAST(DATEPART(ss, [Interval]) AS char)) AS Times
FROM dbo.Detail
What comes back looks like this:
2001.10.16,0.2.0 and I bet if the month or day are single digits it would look like 2001.1.1
What I want is 2001.01.01 00:02:00, i.e something that looks like a date.
Since I have no control over the final interface I need to deliver the data in this format.
How do I pad zeros in front of single digit values?
TIA
Peter Pirker
Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?
(Woody Allen)