Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
declare @time intset @time = 609select cast((@time / 60) as varchar(2)) + ':' + cast((@time % 60) as varchar(2))should return 10.09 where i am wrong
webfred
Master Smack Fu Yak Hacker
8781 Posts
Posted - 2010-12-05 : 06:57:31
select cast((@time / 60) as varchar(2)) + ':' + right('00'+cast((@time % 60) as varchar(2)),2)No, you're never too old to Yak'n'Roll if you're too young to die.
pnasz
Posting Yak Master
101 Posts
Posted - 2010-12-05 : 07:57:16
is there anyway to convert it to integer as answer we are getting in varchar
webfred
Master Smack Fu Yak Hacker
8781 Posts
Posted - 2010-12-05 : 09:05:39
10.09 isn't integer but I think you mean this:declare @time intset @time = 609select (@time / 60) + (@time % 60/100.0)No, you're never too old to Yak'n'Roll if you're too young to die.
No he wanted 10.09 instead of 10:09No, you're never too old to Yak'n'Roll if you're too young to die.
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts
Posted - 2010-12-05 : 11:05:02
Just be careful because 10:09 <> 10.09 if you are going to be aggregating time. 9/60 is a lot different than 9/100....Poor planning on your part does not constitute an emergency on my part.