Thanks for the help, if I do this (No Convert datetime):
CAST(CONVERT(varchar(4), DATEPART(mm, FeatureDate)) + '-'
+ CONVERT(varchar(2), DATEPART(dd, FeatureDate)) + '-'
+ CONVERT(varchar(4), DATEPART(yyyy, FeatureDate)) + ' '
+ CONVERT(char(2), LEFT(time_start,2)) + ':'
+ CONVERT(char(2), RIGHT(time_start,2)) + ' '
+ time_start_am_pm
AS varchar(20)) AS DateTimeStart
I get this:
10-15-2008 07:30 PM
8-1-2009 08:00 AM
7-5-2009 09:00 AM
2-8-2009 08:00 AM
But with the CONVERT added, I get this message:
Msg 242, Level 16, State 3, Line 21
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
I tried specifying the style (mm/dd/yy) like this:
CONVERT(datetime, CAST(CONVERT(varchar(4), DATEPART(mm, FeatureDate)) + '-'
+ CONVERT(varchar(2), DATEPART(dd, FeatureDate)) + '-'
+ CONVERT(varchar(4), DATEPART(yyyy, FeatureDate)) + ' '
+ CONVERT(char(2), LEFT(time_start,2)) + ':'
+ CONVERT(char(2), RIGHT(time_start,2)) + ' '
+ time_start_am_pm
AS varchar(20)), 100 ) AS DateTimeStart
But go this:
Msg 241, Level 16, State 1, Line 21
Conversion failed when converting datetime from character string.