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.
JCTDDAsked:
Who is Participating?
 
Rajkumar GsConnect With a Mentor Software EngineerCommented:

declare @time varchar(10)
set @time = '930'
select substring(@time, 1, len(@time) - 2) + ':' + substring(@time, len(@time) - 1, len(@time))

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.