DECFLOAT
Example
Section titled “Example”DECLARE @myDecfloat DECFLOAT;SET @myDecfloat = 10.567;
SELECT @myDecfloat as Value;Output
Section titled “Output”Value-----------10.567Explanation
Section titled “Explanation”In the SQL code example, a DECFLOAT variable ‘@myDecfloat’ is declared and assigned the value “10.567”. Then, a SELECT statement is used to view the value of ‘@myDecfloat’. The output shows the stored value “10.567”.
Example
Section titled “Example”DECLARE @MyVar DECFLOAT(34);SET @MyVar = 1234567890.123456;SELECT @MyVar AS 'DECFLOAT Value';Output
Section titled “Output”DECFLOAT Value--------------------------------1234567890.123456Explanation
Section titled “Explanation”In the example, a variable, @MyVar, of DECFLOAT data type with a precision of 34 is declared. The @MyVar variable is then set to the numerical value 1234567890.123456. The SELECT statement is subsequently used to display the set value of the @MyVar variable. The DECFLOAT data type holds large decimal numbers with high precision, it can hold up to 34 digits to the left and right of the decimal point.