Question

SQL server default newid() not working (identifier written as <null> by FME creating duplicate key value)

  • 21 February 2022
  • 2 replies
  • 27 views

Badge

I have come across this issue a cuple of times and I want to understand what is happening:

I use newid() to insert uniqueidentifier for all new rows.

The writer set to import table definition from datasource and thus includes the local_id attribute (defualt to newid())

 

My features to INSERT already have a local_ids from the source that i need to remove which I do my remove the attribute all together using the featureManager transformer. Despite of this FME produce an insert query with local_id is set to <null>.

 

Do I really need to remove my local_id in the writer for it to be left alone to let the DB produce the id?

I have other columns default to timestamp (Now()) and that is triggered as expected by the DB, so I am a bit confused to why the identifyer key is treated differently.


2 replies

Userlevel 5
Badge +29

In your writer, check that the output attributes tab doesn't have 'local_id' specified

Badge

I am running fme_db_operation, using the same writer for UPDATE, INSERT and DELETE so I cannot remove local_id without duplicating the writer. Easier to make FME create GUID for me instead of the database, altough I would had prefer the db to create the GUID for me

Reply