March 28, 2003 at 1:54 pm
Hi,
In the SQL Server 2000 database, I have a decimal column with 5 precisions and 1 scale defined ([S_Sales_Measure] [decimal](5, 1) NULL). I am using third party analytical tool (Sagent) to do all the calculations and load data into another table which contains this decimal column, and I am having a problem that when it loads into the column, it didn't do rounding but just drop the second decimal point. For example, if I load into excel, one number shows -9.37597, but the column in SQL Server database will show -9.3.
Does anybody know what possibly happened?
Thank you.
March 28, 2003 at 2:23 pm
Because you defined only 1 scale for column ([S_Sales_Measure]. Change it to ([S_Sales_Measure] [decimal](10, 5) NULL).
March 28, 2003 at 2:43 pm
I am sorry, I didn't explain it clear. I need this column with 1 decimal point only. If the source loads more than 1 decimal point, the column has to round it to store only 1 decimal point.
March 28, 2003 at 9:37 pm
I don't know whether this analytical tool (Sagent) can transform data to round the decimal number to 1 scale. If it can't, try to load the whole decimal number into SQL Server table first and update it with ROUND function. For example
create table #t1 (c1 decimal (10,5))
insert #t1 values (-9.37597)
select * from #t1
create table mytable (mycol decimal (10,1))
insert into mytable select round(c1,1) from #t1
select * from mytable
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply