June 11, 2009 at 12:56 am
Dear All,
i am new to sql server. i need to convert string '145010' to time format 14:50:10 in sql server 2005.
any help is highly appreciated.
thanks
fairozkhan
June 11, 2009 at 1:05 am
declare @st char(6)
declare @dt datetime
set @st = '145010'
set @dt = left(@st,2) + ':' + substring(@st,3,2) + ':' + right(@st,2)
select @dt
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 11, 2009 at 1:23 am
Thanks Adi, it did helped me.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply