• pksutha (3/22/2011)


    My answer is like this

    first part which is i 've answered:

    Declare @value1 decimal(20,10),@value2 decimal(20,3)

    SET @value1 = 1234567890.123456789

    SET @value2 = 0.1

    SELECT @value1 * @value2

    Second part is screened answer:

    DECLARE @value1 DECIMAL(20,10), @value2 DECIMAL(30,13)

    SET @value1 = 1234567890.123456789

    SET @value2 = 0.1

    SELECT @value1 * @value2

    Ans:

    The screened answer is u 've declared value2 decimal(30,13)... why u need like that?

    my answer is Declare @value1 decimal(20,10),@value2 decimal(20,3)...... this is enough in SQL server 2005

    That's kind of the "moral" of the question. Never use a "bigger" decimal/numeric than you actually need.