Have time show with the date in SQL Server

I have the following code which shows date... Ex:(02/06/2012)
convert(varchar, CAST(TS_Day2 as datetime),101) as Expected,

I also have code that shows the date and time... Ex:(Feb 6 2012 7:15AM)
CONVERT(varchar(20), CAST(a.Expected AS datetime), 100) as Expected,

What code do I use if I want... 01/06/2012 7:15AM?
I don't want Jan, Feb, I want 01 and 02.
BobRosasAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
JestersGrindConnect With a Mentor Commented:
You could do something like this.

SELECT CONVERT(VARCHAR, CAST(TS_Day2 AS DATETIME),101) + SUBSTRING(CONVERT(VARCHAR, CAST(TS_Day2 AS DATETIME),100), 12, 10) AS Expected

Open in new window


Greg
0
 
BobRosasAuthor Commented:
Worked great!  Thank you so much!
0
All Courses

From novice to tech pro — start learning today.