cancel
Showing results for 
Search instead for 
Did you mean: 

Change SQL decimal delimiter

Former Member
4,822

Hello! I am trying to import data into my table using

INPUT INTO

The problem is my decimals is using , as a delimiter, and it expects .. So it won't work!

How can i change this? Search and replace in the input file is not an option!

I am using SQL Anywhere 10

Accepted Solutions (0)

Answers (2)

Answers (2)

VolkerBarth
Contributor

Erik,

AFAIK formatting numbers is not possible with builtin tools in SA. The main reason is that "formatting" is seen as a client-task and not one for the server. (Though there definitely are reasons to take a different view, methinks.)

There are a few workarounds, cf. the newsgroup sybase.public.sqlanywhere.general.

Just a few threads that might fit:

news://forums.sybase.com:119/1dkft15000qu40c6vf0qbhibackbfcghju@4ax.com

news://forums.sybase.com:119/op.udxdyasyj0bybf@bonw00164.internal.imsglobal.com

(If those links don't work, you might search for decimal in this newsgroup.)

HTH Volker

thomas_duemesnil
Participant

Erik.

Probably you can pull the date in a staging (temporary) Table. You could read the Field in as a string value.

In as second step you can the push it into the correct destination.

insert into stageTable ...
select CAST( replace(stageTable.StrNumber,',','.') as numeric(12,4) ),.... 
form stageTable

HTH Thomas