How to update a record Using SQL SERVER UPDATE without updating identity field
The process established by the company I work for is that we have the document coming into a MAPPER, that links the incoming fields to the SQL SERVER UPDATE Snap. This tells the UPDATE snap which fields should receive which values, but this includes the identity field. I cannot exclude the identity field, because then the update fails because it does not have a value to compare in the where clause
To put this into a SQL context:
What I want to do:
UPDATE table
SET FIELD = value
WHERE ID = id
What the Mapper + Update is doing:
UPDATE table
SET FIELD = value
AND ID = id
WHERE ID = id
And if I remove the ID field from the Mapper, then the pipeline fails because the field doesn't exist, but esentially I am trying to tell SQL to:
UPDATE table
SET FIELD = value
WHERE ID = null
This has only occurred on 1 of our servers, which is how I've discovered that the ID field is being updated on the other servers. We had assumed that Snap knew not to update the ID field.
I am investigating SQL to see how the other servers are able to allow this on IDENTITY fields
But I am posting here, because I am concerned that we are going about doing the updates, incorrectly
Thanks for any assistance anyone is able to provide
The whole point of reading data from an empty table in
snowflake - select snapwas to record the counts, as there is no easier way to do that when the table is empty, we can leverage thesnowflake - execute snapand modify the query to get the counts ONLY.Return data type is an integer for me which I don’t have any concern with and, if need be, that can be converted to a String. Thus, the easiest solution is to use a
Snowflake - Executesnap instead of a Snowflake - Select and modify the query.P.S.: All snowflake snaps trying to fetch data in an empty table wouldn’r return anything. Not even Null or 0.
Closing this thread now. Thank you.