You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MERGE [dbo].[Students] WITH (HOLDLOCK) AS T
USING (SELECT TOP 1 * FROM [dbo].[StudentsTemp9c324527] ORDER BY [StudentId]) AS S
ON T.[StudentId] = S.[StudentId]
WHEN NOT MATCHED BY TARGET THEN INSERT ([Name]) VALUES (S.[Name])
WHEN MATCHED AND EXISTS (SELECT S.[Name] EXCEPT SELECT T.[Name]) THEN UPDATE SET T.[Name] = S.[Name]
WHEN NOT MATCHED BY SOURCE THEN DELETE
OUTPUT COALESCE(INSERTED.[StudentId], DELETED.[StudentId]), COALESCE(INSERTED.[Name], DELETED.[Name]),(CASE $action WHEN 'UPDATE' THEN 1 Else 0 END),(CASE $action WHEN 'DELETE' THEN 1 Else 0 END) INTO [dbo].[StudentsTemp9c324527Output];
int totalNumber = entities.Count;
int numberUpdated = [...]
int numberDeleted = [...]
BulkConfig.StatsInfo = new StatsInfo
{
StatsNumberUpdated = numberUpdated,
StatsNumberDeleted = numberDeleted,
StatsNumberInserted = totalNumber - numberUpdated - numberDeleted
};
StatsNumberInserted = totalNumber - numberUpdated - numberDeleted
I think, the number of inserted records cannot be calculated in this way, because of the additional statement AND EXISTS (SELECT S.[Name] EXCEPT SELECT T.[Name]) after WHEN MATCHED.
The text was updated successfully, but these errors were encountered:
I'm using EFCore.BulkExtensions v6.0.7 and initialize my table on a MS SQL server with
Later I'm using the following code to sync the data (in fact there is no difference):
I would expect that all statistic numbers are 0, but the lines
output
The generated merge statement was as follows
the class TableInfo has the following lines:
I think, the number of inserted records cannot be calculated in this way, because of the additional statement
AND EXISTS (SELECT S.[Name] EXCEPT SELECT T.[Name])
afterWHEN MATCHED
.The text was updated successfully, but these errors were encountered: