Skip to main content
Question

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

  • February 21, 2022
  • 2 replies
  • 228 views

so_much_more
Supporter
Forum|alt.badge.img+6

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

hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • February 21, 2022

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


so_much_more
Supporter
Forum|alt.badge.img+6
  • Author
  • Supporter
  • February 22, 2022

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings