Saturday, February 25, 2012

Convert question

Hi,
I am importing data form a text file and I have a problem with a column
format
In the file, the numbers are are stored with this format: -54.565,49
Now I have to change the format to -54565.49 to store this value into a
decimal using DTS
Could you help me ?
ThanksDid you transpose the ',' and the '.' ? Is the original format really
-54.565,49 or -54,565.49?
"Javier" wrote:

> Hi,
> I am importing data form a text file and I have a problem with a colum
n
> format
> In the file, the numbers are are stored with this format: -54.565,49
> Now I have to change the format to -54565.49 to store this value into a
> decimal using DTS
> Could you help me ?
> Thanks
>
>|||Yes, the format is -54.565,49
The values are stored in a text file and I can not change it
Thanks
"Mark Williams" <MarkWilliams@.discussions.microsoft.com> wrote in message
news:7853108E-79F4-4C23-805A-EEE5EDE2781C@.microsoft.com...
> Did you transpose the ',' and the '.' ? Is the original format really
> -54.565,49 or -54,565.49?
>
> "Javier" wrote:
>|||Hi
It may work if you change the regional settings, although you may want to
make the solution non-region specific! One way would to use and activeX
transformation and treat the field as a string. You can then use the replace
function in your script to remove the thousand delimiter and replace the
commas with a decimal point.
John
"Javier" <jvillegas@.elsitio.net> wrote in message
news:erY%23rClCGHA.2644@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I am importing data form a text file and I have a problem with a column
> format
> In the file, the numbers are are stored with this format: -54.565,49
> Now I have to change the format to -54565.49 to store this value into a
> decimal using DTS
> Could you help me ?
> Thanks
>|||Using T-SQL, you could use a statement like...
Select select replace(replace(<Column Name>,'.',''),',','.')
The inside Replace function changes the decimal point to nothing at
all. The outside function changes the comma to a decimal point. The
order of operations is very important here.

No comments:

Post a Comment