Showing posts with label conversion. Show all posts
Showing posts with label conversion. Show all posts

Friday, March 30, 2012

Numeric[DT_NUMERIC] - comma or dot

Hi,

I have this problem:

In one SSIS project that I have, I convert (by using Data Conversion) my numeric column into Numeric[DT_NUMERIC] and get:

1.000000

Then, in another project I convert the same column again into Numeric[DT_NUMERIC] and get:

2,000000

Does anybody know how I can control if I′m using a dot or a comma?

Thank you.

Cannot say I have seen this. Are the packages run on the same machine? If not, are the regional settings the same?|||

Yes, they are running on the same machine.

|||

Arg! My fault, the regional settings of the Flat File was different.

Thanks for the help!! Smile

Wednesday, March 28, 2012

numeric conversion

I have a source table with a varchar field like 0000005467.
My target table has a numeric 18,2 column which I am trying to populate with 54.67 but it keeps rounding the last 2 digits to ZERO's.
Any ideas?
-KTry something likes that:

declare @.str varchar(25)
select @.str='00005667'
select @.str=left(@.str,len(@.str)-2)+'.'+right(@.str,2)
select convert(decimal(10,2),@.str),@.str|||The data field numeric(18,2) will support 2 decimal places but it doesn't assume that a value stored or converted has a 2 decimal value. So you need to tell the system that the converted value has a 2 decimal value, divide by 100.

declare @.x varchar(15)

set @.x = '0000005467'

select convert(numeric(18,2),@.x)/100

Monday, March 12, 2012

Number conversion

Hi all!

I have a int-column that stores large numbers in my table and I want the output from a SELECT-statement to output it diffrent...

If the number is 6 100 000 The output should be 6.1 and 19 000 000 should be 19.1

I would also like the numbers to be rounded to the closest 100 000 (round(myInt, -5) right?)

thanks guys!Is this what your after

SELECT ROUND(Cast(Number as Decimal)/1E6,1)

Dave|||I'd suggest using:SELECT Cast(myColumn / 1e6 AS DECIMAL(6, 1))-PatP