Home Forums SQL Server 7,2000 T-SQL Select statement to reduce precision? RE: Select statement to reduce precision?

  • I'm not sure what you are going after.  If this is a display issue, you may want to handle this in your front-end.  Otherwise, I do not see the problems you are having and I would absolutely not use "float". 

    DECLARE @Money TABLE( Price money)

    INSERT INTO @Money

    SELECT 1

    UNION

    SELECT 1.01

    UNION

    SELECT 1.001

    UNION

    SELECT 2.5002

    UNION

    SELECT 2.5101

    UNION

    SELECT 3.001

    UNION

    SELECT 4.5202

    UNION

    SELECT 2.515

    UNION

    SELECT 2.5555

    SELECT Price, CONVERT( decimal(5,2), Price) AS [ Price 5,2], CONVERT( float, Price) AS [ Price float], ROUND( Price, 2, 1) AS [ Price Round ]

    FROM @Money

    I wasn't born stupid - I had to study.