My Blog List

hotinit.com. Powered by Blogger.

Search This Blog

Precision, Scale, and Length (Transact-SQL)

Monday, 11 July 2011

Precision is the number of digits in a number.

Scale is the number of digits to the right of the decimal point in a number.

For example, the number 123.45 has a precision of 5 and a scale of 2.

Length for a numeric data type is the number of bytes that are used to store the number
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.

Default maximum precision of numeric and decimal data types is 38.

No comments:

Post a Comment

 

Blogger news

Blogroll

Most Reading

8.6/10