JCTDD
asked on
SQL - convert hhmm to datetime
using SQL server 2000
I have a time field that is a char(10) I want to be able to convert it to datetime so can get the semicolon between then hours and mins
BINTVWS.Time_from
1400
1000
930
what is the SQL code to display the above as
14:00
10:00
9:30
using this: CONVERT(VARCHAR(5), cast(BINTVWS.Time_from as datetime), 108) as interviewTimeStart
get err:
Server: Msg 242, Level 16, State 3, Line 13
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
I have a time field that is a char(10) I want to be able to convert it to datetime so can get the semicolon between then hours and mins
BINTVWS.Time_from
1400
1000
930
what is the SQL code to display the above as
14:00
10:00
9:30
using this: CONVERT(VARCHAR(5), cast(BINTVWS.Time_from as datetime), 108) as interviewTimeStart
get err:
Server: Msg 242, Level 16, State 3, Line 13
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.