June 2, 2011 at 8:19 am
Hey,
Is it possible to prevent SQL server from rounding a value on Insertion?
In the sample below: Inserting value 1000.9999 into a field type of less precision will round the values.
MSDN describes the use of ROUND to truncate the decimals without rounding (Round_Truncate in sample).
Is it possible to achieve this in any other way e.g in table definition or through hints?
Thanks
G
CREATE TABLE #Rounder (
Original DECIMAL (8,4)
, Round_Implicit DECIMAL (8,2)
, Round_Truncate DECIMAL(8,2))
INSERT INTO #Rounder SELECT 1000.9999, 1000.9999, ROUND(1000.9999,2,1)
SELECT *
FROM #Rounder
-- CLEANUP:
DROP TABLE #Rounder
June 2, 2011 at 9:31 am
June 2, 2011 at 10:08 am
Maybe this ?
SET NUMERIC_ROUNDABORT ON
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply