I have these values
100
900
1300
in int format , now i want to convert them to hh:mm:ss tt format in sql. How can this be done ? I have used this query
declare @nvsDateTime int;set @nvsDateTime = 100;
select convert(datetime, convert(varchar(10),CURRENT_TIMESTAMP,120) + ' ' + stuff(ltrim(@nvsDateTime),3,0,':') ) AS Answer
But it is only converting 100 and 1300 but not 900 and giving me this error :
Msg 242, Level 16, State 3, Line 2
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.