Skip to main content
Question

Is there someway to automatically add an IDENTITY column when writing to SQL Server spatial?

  • July 4, 2016
  • 3 replies
  • 188 views

Forum|alt.badge.img

Is there someway to automatically add an IDENTITY column when writing to SQL Server spatial?

I've found MapInfo data inserted into SQL Server spatial is flagged as invalid when I try to load it in QGIS. The solution seems to be to add an integer "id" column, which I set as an IDENTITY

I can manually add the ID column after a first run of FME has created table plus columns. Then truncate the SQL table and run the workspace a second time to populate with the actual data and the ID column set by SQL Server.

But I've got a lot of MapInfo layers to migrate, so is there a better way to do this in FME?

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

Forum|alt.badge.img
  • July 5, 2016

I haven't tried this but could you 1. add a counter to create the ID column, 2. use a FeatureWriter to write to SQL and then 3. use a SQLExecutor to change the SQL datatype afterwards?


Forum|alt.badge.img+5

Can you run it as a dynamic translation and add that column into the feature type definition? That way you should get all the original attributes, plus every table will get the new id column.


Forum|alt.badge.img+2

You should be able to populate the identity column the FME SQL Server writer. On the SQL Server writer feature type, under the Format Properties tab, Advanced disclosure panel you have the option to insert into identity column . If you leave the default setting then SQL Server will automatically populate the identity column for you.

To create the identity column, use the User Attribute tab and set the field type to be identity