Skip to main content
Released

SQL Server writer Varchar as default

Related products:FME Form
  • January 5, 2016
  • 14 replies
  • 128 views

Forum|alt.badge.img+5

Writing to SQL Server can be frustrating if you don't pay attention to the attribute types. Generally Varchar is needed as any whitespace may cause issues with styling data in Arcmap or other GIS programs. The default character type should change to reflect the best types for any given writer.

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.

14 replies

erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • January 5, 2016

I second this.

For Oracle too the Varchar2 type is highly recommended over the default Char type as the Char type appends spaces to the actual value.


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • January 5, 2016

The nicest way to do this is using the FME options and being able to set up the default datatype per Writer for character and numeric attributes. You could even add a default precision per datatype (e.g Oracle character: Varchar2(20), numeric: Number(38,0) ).


ravenkopelman
Safer
Forum|alt.badge.img+1

What context do you see this default in? When generating a new workspace that translates from format X to SQL Server, or when manually adding writer feature types?


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • January 5, 2016

I would suggest in every location that FME now decides what datatype to use. So if the datatype is not predefined in the database (new writer or new featuretype) the default should be used.

The precision could be defined by the data, but I have experienced quite often that the precision is defined by the first x number of rows and is not sufficient for the complete dataset.


fmelizard
Safer
Forum|alt.badge.img+22
  • Safer
  • January 5, 2016

Thanks for pointing out a very old default that is hardcoded in workbench. WIth time we are trying to make Workbench much smarter with data types in general, but in the very short term (2016.1) we will change this default to varchar which will be so much smarter on most modern systems.


fmelizard
Safer
Forum|alt.badge.img+22
  • Safer
  • January 5, 2016

Being able to adjust the default is a great idea too, we'll think more deeply on that.


erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • January 5, 2016

And to Varchar2 for Oracle, please!


Forum|alt.badge.img+5
  • Author
  • January 7, 2016

Great, looking forward to 2016 release!


revesz
Supporter
Forum|alt.badge.img+21
  • Supporter
  • February 3, 2016

char(x) is the default when a string attribute value is calculated, it is from a web service, (maybe from CSV) and similar situations when FME just guesses the data type.


Forum|alt.badge.img+2

This has been addressed in FME 2016.1. By default mapping will be to varchar whereever possible


  • July 6, 2016

Yay, finally got 2016.1 two hours ago! There is varchar datatype, right, but why can't I delete the numer in the width field? Does it give the max number of characters? And what can I do if I don't want to give a max length? Thanks for your help...


  • June 1, 2017

I have small recomendation. If you plan to use Geoserver for data publishing I realy recommend to use nvarchar instead varchar. Varchar makes strange things in geoserver,mostly using in SLD or CQL filters...


  • August 28, 2022

Hello from the future in 2022 :) I am working with FME 2020.0 and I am running in to this issue. When I create a new workspace using the wizard from GTFS to SQL Server Non-Spatial it creates the basic workspace and when I check the (Static Schema) writer feature types I see only text as the 'Type' in the writers. I had thought this issue fixed due to the above conversation.

 

Could it be this issue is still hanging around on the computer or is there something else I need to do to get this to work? Appreciate any assistance!


andreaatsafe
Safer
Forum|alt.badge.img+17

Hi @marcmpo​ ,

I reviewed the workspace and the document with the screenshots you shared.

From the screenshots you shared, I can see the data types are being mapped over as expected. There are attributes in the source data that have the data type as "text" so they are being mapped to "text" in the writer. But there are also other data types in the source data (eg. integer, time) that are being mapped to appropriate data types in the writer as well.

imageI hope this helps. If you're still needing further assistance, please submit a new question to our forum.

Thank you,

Andrea