GoEddie / GoEddie/SSDT-DevPack
MergeUI does not include SET IDENTITY_INSERT <tablename> ON prior to MERGE statements that perform INSERTs
- Dominant language
- C#
- Stars
- 41
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
When I use MergeUI to generate insert + update + delete statements, and the table I generate the statement for has an IDENTITY column, I get a MERGE statement that contains an INSERT
```sql
WHEN NOT MATCHED BY TARGET THEN INSERT ([id],...
```
But here id is an IDENTITY column, so that fails with the error:
```
[S0001][544] Cannot insert explicit value for identity column in table '' when IDENTITY_INSERT is set to OFF.
```
I could surround the MERGE statement with the statement to allow INSERTs
```sql
SET IDENTITY_INSERT ON
SET IDENTITY_INSERT OFF
```
But that somehow feels wrong, since the tool itself knows already that it has to generate inserts. I think MergeUI itself should surround SET IDENTITY_INSERT.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.