December 17, 2009 at 5:56 am
Find the datediff between the last row creationdate and getdate into seconds. Convert the seconds to percentage value.
DATEDIFF(SS,@CreationDate, getdate())/86400)*100
will this work?
December 17, 2009 at 7:24 am
A simple test and you would get the answer 🙂
Return type of a datediff is integer and you will get 0 i think. So may be this will help you?
Declare @date datetime
SET @date = dateadd(mi, 5,getdate())
SELECT ((convert(float,DATEDIFF(SS, getdate(), @date)))/86400) * 100
---------------------------------------------------------------------------------
December 17, 2009 at 7:52 am
Thanks very much for your help.
December 17, 2009 at 9:00 am
Sorry, this should also do (its implicit, my bad!)
Declare @date datetime
SET @date = dateadd(mi, 5,getdate())
SELECT (DATEDIFF(SS, getdate(), @date)/86400.00) * 100
---------------------------------------------------------------------------------
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply