Precision is the number of digits present in a number. For example,
the number 123.45 has a precision of 5
Scale is the number of digits to the right of the decimal point in
a number. For example, the number 123.45 has a scale of 2.
Length is the number of bytes that are used to store the data. For
example, length for a character string or Unicode data type is the number of
characters. The length for binary, varbinary, and image data types is the
number of bytes.
For example, an int data type
can hold 10 digits, is stored in 4 bytes, and does not accept decimal points.
The int data type has a precision of 10, a length of 4, and a scale of 0.
When two char, varchar,
binary, or varbinary expressions are concatenated, the length of the resulting
expression is the sum of the lengths of the two source expressions or 8,000
characters, whichever is less.
Example:
Precision 5, scale 3 : 54.321
Precision 5, scale 1 : 5432.1
Precision 5, scale 0 : 54321
Precision 5, scale -1 : 54320
Precision 5, scale -3 : 54000
Example:
Precision 5, scale 3 : 54.321
Precision 5, scale 1 : 5432.1
Precision 5, scale 0 : 54321
Precision 5, scale -1 : 54320
Precision 5, scale -3 : 54000
No comments:
Post a Comment