decimal (12,2)

decimal (12,2) - SQL/NoSQL - Programmation

Marsh Posté le 09-12-2005 à 16:18:40    

bonjour,
debutante en sql j'ai besoin d'aide:
voila dans une des tables que j'utilise, un des champs est declaré en decimal (12,2). Je comprends bien que le champs est donc decimal mais a quoi servent le 12 et le 2??
merci pour votre aide

Reply

Marsh Posté le 09-12-2005 à 16:18:40   

Reply

Marsh Posté le 09-12-2005 à 16:22:51    

Citation :

decimal[(p[, s])] and numeric[(p[, s])]
 
Fixed precision and scale numbers. When maximum precision is used, valid values are from - 10^38 +1 through 10^38 - 1. The SQL-92 synonyms for decimal are dec and dec(p, s).
 
p (precision)
 
Specifies the maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision. The maximum precision is 38. The default precision is 18.
 
s (scale)
 
Specifies the maximum number of decimal digits that can be stored to the right of the decimal point. Scale must be a value from 0 through p. Scale can be specified only if precision is specified. The default scale is 0; therefore, 0 <= s <= p. Maximum storage sizes vary, based on the precision.


 
http://msdn.microsoft.com/library/ [...] z_3grn.asp

Reply

Marsh Posté le 15-12-2005 à 10:16:45    

Pour les anglophobes... :
 
12 -> le nombre de chiffre, decimales incluses
2 le nombre de decimales.
 
donc voila ton format :
9999999999.99


Message édité par belldandys le 15-12-2005 à 10:17:16
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed