fme-form – Creating Auto-Incrementing Primary Key with Dynamic Writer in FME

fmespatial-etlsql-server-spatial

I'm writing 3 shapefiles to an MSSQL Spatial database with FME. I'm using a writer with dynamic settings to simplify future updates of the input files.

In order to create a spatial index with the dynamic writer I need a primary key column. Right now, I'm accomplishing this with a Counter that writes to a manually created "pid"-attribute marked as primary key, but this feels like a hack.

So, how do I create an auto-incrementing primary key on a dynamic database writer in FME?

Best Answer

No experience with MSSQL but for PostgreSQL it works by selecting the datatype serial and the index PrimaryKey. See screenshot.

I suspect the datatype should be identity with index PrimaryKey. See also this documentation.

FeatureWriter Parameters

Big StackExchange fan but you will have better chances getting a good answer on the Safe Software forum. Lots of knowledge and activity.

Related Question