Skip to main content
Question

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

  • October 15, 2020
  • 3 replies
  • 45 views

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.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

ebygomm
Influencer
Forum|alt.badge.img+45
  • 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+45
  • Influencer
  • October 16, 2020

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?