Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Round to next 5 value
Message
De
07/03/2007 14:45:49
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01201576
Message ID:
01201742
Vues:
12
Hi Kirk,

I believe this will not round the value to the nearest multiple of 5 integer, but will reduce it to the nearest multiple of 5 integer smaller than the original integer. If that's what you want you're good to go. But if you want it rounded, you'll have to use a different method.

Bill

>Naomi
>
>Since my minutes values were Ints and not time value, I had to modify it how I initially stored the value
>
>
>
>declare @decDuration Decimal(10,2)
>declare @tiDuration int
>
>-- We are going to store the duration initially in a decimal so that we can
>-- round it to the nearest 5 minute value.  This will take care
>-- of 14,29,44,59 minute values
>
>set @decDuration=(Select defaultTime from coProc where procID=@tiProcID)
>
>-- Use the ceiling function to move it to the nearest 5 minute value
>set @tiDuration=Ceiling(@decDuration/5)*5
>
>declare @tiDurationIncrement int
>set @tiDurationIncrement = @tiDuration/15
>
>
>Thanks for the links and help.
>
>Kirk
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform