Skip to main content
Question

Text being converted to decimal when reading from excel into SQL database


I have a script that uses excel reader and writes into a SQL database. It works fine but one issue is that a field I'm trying to copy has a 'version number' such as 5.1.01 or 5.3 where 5.1.01 is coming out fine but 5.3 is appearing in the db as 5.29999999 as shown below

result

The version column is set to 'Text' in the excel sheet.

The excel reader is using the 'char' type as shown belowreader_attribute

The writer is set to use the 'nvarchar' type as shown below, which is the same as the type in the database 'nvarchar(255)'

writer_attribute

It appears somewhere in the process these values are being interpreted as a decimal or float but I haven't been able to work out how to fix this.

I'm relatively new to FME so Its possible I may be missing something.

 

Any help would be greatly appreciated.

 

3 replies

ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • October 15, 2020

Have you double checked that the figure is definitely 5.3 in the excel sheet?

This cell is formatted as text and displays 5.3 but if you look at the formula bar it's actually the decimal

 

Capture


  • Author
  • October 15, 2020

Hi Ebygomm, thanks for the response.

I've just checked and that isn't the case.


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • October 16, 2020
hullj wrote:

Hi Ebygomm, thanks for the response.

I've just checked and that isn't the case.

Is your workspace doing anything other than transferring data from excel to sql?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings