Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting Decimal/Fractional Part
Message
De
13/12/2004 14:22:03
 
 
À
13/12/2004 00:48:33
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00968658
Message ID:
00968865
Vues:
7
>Hi ,
> I usually use Modulo operator (% in SQL) to get the decimal or fraction part of the numeric value
> eg:
> @Num1=8989.678
> @Num2=1
> @NumDecimalPar = @Num1 % @Num2
>
>my problem is the Modulo in MSSQL works only for Interger data type. Is there way or function w/c I use on getting the decimal/or the fraction part of numeric data type?
>
>my current solution is to covert it to Varchar and use Substring to chop it. then cast it back to numeric data type
>
>
>
>Tnx in advance
declare @Num1 decimal(13,4)
set @Num1=1.545
select  @Num1 - FLOOR(@Num1) 
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform