Saturday 12 January 2013

Numeric Data type for 1 decimal point.

I wanted to store a number with 1 decimal point and found myself looking how to do it today.

DECIMAL allows you to specify first the number of digits in total (precision) and secondly how many will be after the decimal point.

DECIMAL(2,1) is what I need therefore, to store a single digit before & after the point
e.g. 1.0, 2.0, 2.1, 2.2 etc.

NB : DECIMAL and NUMERIC are interchangable in SQL Server, the latter being a hangover from Sybase days.

Links :
Number Data Types in T-SQL

No comments: