GoEddie / GoEddie/SSDT-DevPack

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

Open
#23 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
41
Forks
19
PR merge metrics
No merged PRs in 30d

Description

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:
```sql
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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.