Skip to content

MergeUI Does not exclude identity columns from update statements (Causes "Cannot update identity column 'X'") #23

@lestephane

Description

@lestephane

When i use MergeUI to generate inserts + updates + deletes for a specific table of mine with an 'id' identity key, I get some statements that try to UPDATE identity columns, causing a Cannot update identity column 'id'.

Here is an example:

MERGE INTO [dbo].[...]
 AS TARGET
USING (VALUES(...) AS SOURCE(...) ON [SOURCE].[id] = [TARGET].[id]
WHEN NOT MATCHED ...
WHEN MATCHED AND (...) THEN UPDATE
SET [TARGET].[id] = [SOURCE].[id]

Why try to UPDATE [TARGET].[id] to the value of [SOURCE].[id] when the two where identical in the ON part of the MERGE statement?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions