diff --git a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs
index 717d31dad4f..64c4d282642 100644
--- a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs
+++ b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs
@@ -200,6 +200,43 @@ protected override Expression VisitValues(ValuesExpression valuesExpression)
return valuesExpression;
}
+ ///
+ /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
+ /// the same compatibility standards as public APIs. It may be changed or removed without notice in
+ /// any release. You should only use it directly in your code with extreme caution and knowing that
+ /// doing so can result in application failures when updating to a new Entity Framework Core release.
+ ///
+ protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunctionExpression)
+ {
+ if (sqlFunctionExpression is { IsBuiltIn: true, Arguments: not null }
+ && string.Equals(sqlFunctionExpression.Name, "COALESCE", StringComparison.OrdinalIgnoreCase))
+ {
+ var head = sqlFunctionExpression.Arguments[0];
+ if (head.TypeMapping != sqlFunctionExpression.TypeMapping)
+ {
+ head = new SqlUnaryExpression(
+ ExpressionType.Convert,
+ head,
+ sqlFunctionExpression.Type,
+ sqlFunctionExpression.TypeMapping);
+ }
+
+ sqlFunctionExpression = (SqlFunctionExpression)sqlFunctionExpression
+ .Arguments
+ .Skip(1)
+ .Aggregate(head, (l, r) => new SqlFunctionExpression(
+ "ISNULL",
+ arguments: [l, r],
+ nullable: true,
+ argumentsPropagateNullability: [false, false],
+ sqlFunctionExpression.Type,
+ sqlFunctionExpression.TypeMapping
+ ));
+ }
+
+ return base.VisitSqlFunction(sqlFunctionExpression);
+ }
+
///
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
diff --git a/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs
index dee6147bff4..828266d405c 100644
--- a/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs
+++ b/test/EFCore.Specification.Tests/Query/NorthwindMiscellaneousQueryTestBase.cs
@@ -729,6 +729,13 @@ public virtual Task Ternary_should_not_evaluate_both_sides_with_parameter(bool a
}));
}
+ [ConditionalTheory]
+ [MemberData(nameof(IsAsyncData))]
+ public virtual Task Coalesce_Correct_Type(bool async)
+ => AssertQuery(
+ async,
+ ss => ss.Set().Select(c => c.Region ?? "no region specified"));
+
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Null_Coalesce_Short_Circuit(bool async)
@@ -2927,7 +2934,7 @@ public virtual Task Select_Where_Subquery_Equality(bool async)
=> AssertQuery(
async,
ss => from o in ss.Set().OrderBy(o => o.OrderID).Take(1)
- // ReSharper disable once UseMethodAny.0
+ // ReSharper disable once UseMethodAny.0
where (from od in ss.Set().OrderBy(od => od.OrderID).Take(2)
where (from c in ss.Set()
where c.CustomerID == o.CustomerID
diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs
index 5ad9edf7ed3..e8ffa535657 100644
--- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs
@@ -94,7 +94,7 @@ public override async Task Update_non_owned_property_on_entity_with_owned2(bool
AssertSql(
"""
UPDATE [o]
-SET [o].[Title] = COALESCE([o].[Title], N'') + N'_Suffix'
+SET [o].[Title] = ISNULL([o].[Title], N'') + N'_Suffix'
FROM [Owner] AS [o]
""");
}
@@ -184,7 +184,7 @@ public override async Task Update_with_alias_uniquification_in_setter_subquery(b
"""
UPDATE [o]
SET [o].[Total] = (
- SELECT COALESCE(SUM([o0].[Amount]), 0)
+ SELECT ISNULL(SUM([o0].[Amount]), 0)
FROM [OrderProduct] AS [o0]
WHERE [o].[Id] = [o0].[OrderId])
FROM [Orders] AS [o]
diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs
index 7490c030160..dc612668069 100644
--- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs
@@ -1024,7 +1024,7 @@ public override async Task Update_Where_set_property_plus_constant(bool async)
AssertExecuteUpdateSql(
"""
UPDATE [c]
-SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + N'Abc'
+SET [c].[ContactName] = ISNULL([c].[ContactName], N'') + N'Abc'
FROM [Customers] AS [c]
WHERE [c].[CustomerID] LIKE N'F%'
""");
@@ -1035,11 +1035,11 @@ public override async Task Update_Where_set_property_plus_parameter(bool async)
await base.Update_Where_set_property_plus_parameter(async);
AssertExecuteUpdateSql(
-"""
+ """
@__value_0='Abc' (Size = 4000)
UPDATE [c]
-SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + @__value_0
+SET [c].[ContactName] = ISNULL([c].[ContactName], N'') + @__value_0
FROM [Customers] AS [c]
WHERE [c].[CustomerID] LIKE N'F%'
""");
@@ -1052,7 +1052,7 @@ public override async Task Update_Where_set_property_plus_property(bool async)
AssertExecuteUpdateSql(
"""
UPDATE [c]
-SET [c].[ContactName] = COALESCE([c].[ContactName], N'') + [c].[CustomerID]
+SET [c].[ContactName] = ISNULL([c].[ContactName], N'') + [c].[CustomerID]
FROM [Customers] AS [c]
WHERE [c].[CustomerID] LIKE N'F%'
""");
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocMiscellaneousQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocMiscellaneousQuerySqlServerTest.cs
index de969e5374e..453eda17aa7 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocMiscellaneousQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocMiscellaneousQuerySqlServerTest.cs
@@ -2191,7 +2191,7 @@ public override async Task Enum_with_value_converter_matching_take_value(bool as
@__orderItemType_1='MyType1' (Nullable = false) (Size = 4000)
@__p_0='1'
-SELECT [o1].[Id], COALESCE((
+SELECT [o1].[Id], ISNULL((
SELECT TOP(1) [o3].[Price]
FROM [OrderItems] AS [o3]
WHERE [o1].[Id] = [o3].[OrderId] AND [o3].[Type] = @__orderItemType_1), 0.0E0) AS [SpecialSum]
@@ -2273,8 +2273,8 @@ public override async Task Group_by_aggregate_in_subquery_projection_after_group
AssertSql(
"""
-SELECT [t].[Value] AS [A], COALESCE(SUM([t].[Id]), 0) AS [B], COALESCE((
- SELECT TOP(1) COALESCE(SUM([t].[Id]), 0) + COALESCE(SUM([t0].[Id]), 0)
+SELECT [t].[Value] AS [A], ISNULL(SUM([t].[Id]), 0) AS [B], ISNULL((
+ SELECT TOP(1) ISNULL(SUM([t].[Id]), 0) + ISNULL(SUM([t0].[Id]), 0)
FROM [Tables] AS [t0]
GROUP BY [t0].[Value]
ORDER BY (SELECT 1)), 0) AS [C]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs
index b265e957cf7..7aacdfa441c 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs
@@ -337,14 +337,14 @@ FROM [CompetitionSeasons] AS [c1]
SELECT [a].[Id], [a].[ActivityTypeId], [a].[DateTime], [a].[Points], (
SELECT TOP(1) [c].[Id]
FROM [CompetitionSeasons] AS [c]
- WHERE [c].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c].[EndDate]) AS [CompetitionSeasonId], COALESCE([a].[Points], (
+ WHERE [c].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c].[EndDate]) AS [CompetitionSeasonId], ISNULL(ISNULL([a].[Points], (
SELECT TOP(1) [a1].[Points]
FROM [ActivityTypePoints] AS [a1]
INNER JOIN [CompetitionSeasons] AS [c0] ON [a1].[CompetitionSeasonId] = [c0].[Id]
WHERE [a0].[Id] = [a1].[ActivityTypeId] AND [c0].[Id] = (
SELECT TOP(1) [c1].[Id]
FROM [CompetitionSeasons] AS [c1]
- WHERE [c1].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c1].[EndDate])), 0) AS [Points]
+ WHERE [c1].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c1].[EndDate]))), 0) AS [Points]
FROM [Activities] AS [a]
INNER JOIN [ActivityType] AS [a0] ON [a].[ActivityTypeId] = [a0].[Id]
""");
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs
index 9a04d360e86..efa95d7698e 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs
@@ -1099,7 +1099,7 @@ public override async Task Result_operator_nav_prop_reference_optional_Sum(bool
AssertSql(
"""
-SELECT COALESCE(SUM([l0].[Level1_Required_Id]), 0)
+SELECT ISNULL(SUM([l0].[Level1_Required_Id]), 0)
FROM [LevelOne] AS [l]
LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id]
""");
@@ -1171,7 +1171,7 @@ public override async Task Result_operator_nav_prop_reference_optional_via_Defau
AssertSql(
"""
-SELECT COALESCE(SUM(CASE
+SELECT ISNULL(SUM(CASE
WHEN [l0].[Id] IS NULL THEN 0
ELSE [l0].[Level1_Required_Id]
END), 0)
@@ -2031,7 +2031,7 @@ public override async Task Select_join_with_key_selector_being_a_subquery(bool a
"""
SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id]
FROM [LevelOne] AS [l]
-INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = COALESCE((
+INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = ISNULL((
SELECT TOP(1) [l1].[Id]
FROM [LevelTwo] AS [l1]
ORDER BY [l1].[Id]), 0)
@@ -2943,7 +2943,7 @@ public override async Task Select_optional_navigation_property_string_concat(boo
AssertSql(
"""
-SELECT COALESCE([l].[Name], N'') + N' ' + COALESCE(CASE
+SELECT ISNULL([l].[Name], N'') + N' ' + ISNULL(CASE
WHEN [l1].[Id] IS NOT NULL THEN [l1].[Name]
ELSE N'NULL'
END, N'')
@@ -3808,7 +3808,7 @@ public override async Task Sum_with_selector_cast_using_as(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([l].[Id]), 0)
+SELECT ISNULL(SUM([l].[Id]), 0)
FROM [LevelOne] AS [l]
""");
}
@@ -3822,7 +3822,7 @@ public override async Task Sum_with_filter_with_include_selector_cast_using_as(b
SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id]
FROM [LevelOne] AS [l]
WHERE [l].[Id] > (
- SELECT COALESCE(SUM([l0].[Id]), 0)
+ SELECT ISNULL(SUM([l0].[Id]), 0)
FROM [LevelTwo] AS [l0]
WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])
""");
@@ -3966,7 +3966,7 @@ FROM [LevelOne] AS [l]
LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Id]
GROUP BY [l1].[Name]
HAVING (
- SELECT MIN(COALESCE([l5].[Id], 0) + COALESCE([l5].[Id], 0))
+ SELECT MIN(ISNULL([l5].[Id], 0) + ISNULL([l5].[Id], 0))
FROM [LevelOne] AS [l2]
LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Id]
LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Id]
@@ -3981,7 +3981,7 @@ public override async Task Nested_object_constructed_from_group_key_properties(b
AssertSql(
"""
-SELECT [l].[Id], [l].[Name], [l].[Date], [l0].[Id], [l1].[Name], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], COALESCE(SUM(CAST(LEN([l].[Name]) AS int)), 0) AS [Aggregate]
+SELECT [l].[Id], [l].[Name], [l].[Date], [l0].[Id], [l1].[Name], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], ISNULL(SUM(CAST(LEN([l].[Name]) AS int)), 0) AS [Aggregate]
FROM [LevelOne] AS [l]
LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id]
LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Required_Id]
@@ -4107,7 +4107,7 @@ public override async Task Composite_key_join_on_groupby_aggregate_projecting_on
SELECT [l2].[Key]
FROM [LevelOne] AS [l]
INNER JOIN (
- SELECT [l1].[Key], COALESCE(SUM([l1].[Id]), 0) AS [Sum]
+ SELECT [l1].[Key], ISNULL(SUM([l1].[Id]), 0) AS [Sum]
FROM (
SELECT [l0].[Id], [l0].[Id] % 3 AS [Key]
FROM [LevelTwo] AS [l0]
@@ -4126,7 +4126,7 @@ public override async Task Composite_key_join_on_groupby_aggregate_projecting_on
SELECT [l2].[Key]
FROM [LevelOne] AS [l]
INNER JOIN (
- SELECT [l1].[Key], COALESCE(SUM([l1].[Id]), 0) AS [Sum]
+ SELECT [l1].[Key], ISNULL(SUM([l1].[Id]), 0) AS [Sum]
FROM (
SELECT [l0].[Id], [l0].[Id] % 3 AS [Key]
FROM [LevelTwo] AS [l0]
@@ -4342,7 +4342,7 @@ WHERE [l].[Id] < 5
CROSS APPLY (
SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id]
FROM [LevelOne] AS [l1]
- WHERE [l1].[Id] <> COALESCE([l0].[Level1_Required_Id], 0)
+ WHERE [l1].[Id] <> ISNULL([l0].[Level1_Required_Id], 0)
) AS [l2]
""");
}
@@ -4450,7 +4450,7 @@ FROM [LevelOne] AS [l]
LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Id]
GROUP BY [l1].[Name]
HAVING (
- SELECT MIN(COALESCE([l5].[Id], 0))
+ SELECT MIN(ISNULL([l5].[Id], 0))
FROM [LevelOne] AS [l2]
LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Id]
LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Id]
@@ -4832,7 +4832,7 @@ ORDER BY [l].[Id]
) AS [l4]
LEFT JOIN (
SELECT [l0].[Id], [l1].[Id] AS [Id0], [l2].[Id] AS [Id1], CASE
- WHEN COALESCE((
+ WHEN ISNULL((
SELECT MAX([l3].[Id])
FROM [LevelFour] AS [l3]
WHERE [l1].[Id] IS NOT NULL AND [l1].[Id] = [l3].[OneToMany_Optional_Inverse4Id]), 0) > 1 THEN CAST(1 AS bit)
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs
index c07c15b88a0..5e32b2f0309 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs
@@ -226,7 +226,7 @@ WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3
END
GROUP BY [l3].[Level3_Name]
HAVING (
- SELECT MIN(COALESCE(CASE
+ SELECT MIN(ISNULL(CASE
WHEN [l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l10].[Id]
END, 0))
FROM [Level1] AS [l4]
@@ -370,7 +370,7 @@ public override async Task Result_operator_nav_prop_reference_optional_via_Defau
AssertSql(
"""
-SELECT COALESCE(SUM(CASE
+SELECT ISNULL(SUM(CASE
WHEN [s].[OneToOne_Required_PK_Date] IS NULL OR [s].[Level1_Required_Id] IS NULL OR [s].[OneToMany_Required_Inverse2Id] IS NULL THEN 0
ELSE [s].[Level1_Required_Id]
END), 0)
@@ -539,9 +539,9 @@ WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3
END
GROUP BY [l3].[Level3_Name]
HAVING (
- SELECT MIN(COALESCE(CASE
+ SELECT MIN(ISNULL(CASE
WHEN [l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l10].[Id]
- END, 0) + COALESCE(CASE
+ END, 0) + ISNULL(CASE
WHEN [l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l10].[Id]
END, 0))
FROM [Level1] AS [l4]
@@ -578,7 +578,7 @@ public override async Task Sum_with_selector_cast_using_as(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([l].[Id]), 0)
+SELECT ISNULL(SUM([l].[Id]), 0)
FROM [Level1] AS [l]
""");
}
@@ -592,7 +592,7 @@ public override async Task Sum_with_filter_with_include_selector_cast_using_as(b
SELECT [l].[Id], [l].[Date], [l].[Name]
FROM [Level1] AS [l]
WHERE [l].[Id] > (
- SELECT COALESCE(SUM(CASE
+ SELECT ISNULL(SUM(CASE
WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id]
END), 0)
FROM [Level1] AS [l0]
@@ -783,7 +783,7 @@ public override async Task Nested_object_constructed_from_group_key_properties(b
AssertSql(
"""
-SELECT [s].[Id], [s].[Name], [s].[Date], [s].[InnerId] AS [Id], [s].[Level2_Name0] AS [Name], [s].[OneToOne_Required_PK_Date] AS [Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], COALESCE(SUM(CAST(LEN([s].[Name]) AS int)), 0) AS [Aggregate]
+SELECT [s].[Id], [s].[Name], [s].[Date], [s].[InnerId] AS [Id], [s].[Level2_Name0] AS [Name], [s].[OneToOne_Required_PK_Date] AS [Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], ISNULL(SUM(CAST(LEN([s].[Name]) AS int)), 0) AS [Aggregate]
FROM (
SELECT [l].[Id], [l].[Date], [l].[Name], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l3].[Level2_Name] AS [Level2_Name0], CASE
WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id]
@@ -879,7 +879,7 @@ SELECT [s1].[Key]
FROM [Level1] AS [l]
INNER JOIN (
SELECT [s].[Key], (
- SELECT COALESCE(SUM(CASE
+ SELECT ISNULL(SUM(CASE
WHEN [l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l7].[Id]
END), 0)
FROM (
@@ -933,7 +933,7 @@ SELECT [s1].[Key]
FROM [Level1] AS [l]
INNER JOIN (
SELECT [s].[Key], (
- SELECT COALESCE(SUM(CASE
+ SELECT ISNULL(SUM(CASE
WHEN [l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l7].[Id]
END), 0)
FROM (
@@ -1620,7 +1620,7 @@ WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id]
CROSS APPLY (
SELECT [l2].[Id], [l2].[Date], [l2].[Name]
FROM [Level1] AS [l2]
- WHERE [l2].[Id] <> COALESCE([s].[Level1_Required_Id], 0)
+ WHERE [l2].[Id] <> ISNULL([s].[Level1_Required_Id], 0)
) AS [l3]
""");
}
@@ -1906,7 +1906,7 @@ WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id]
WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id]
END
WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL
-) AS [s] ON [l].[Id] = COALESCE((
+) AS [s] ON [l].[Id] = ISNULL((
SELECT TOP(1) CASE
WHEN [l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id]
END
@@ -3650,7 +3650,7 @@ public override async Task Result_operator_nav_prop_reference_optional_Sum(bool
AssertSql(
"""
-SELECT COALESCE(SUM([l1].[Level1_Required_Id]), 0)
+SELECT ISNULL(SUM([l1].[Level1_Required_Id]), 0)
FROM [Level1] AS [l]
LEFT JOIN (
SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id]
@@ -5898,7 +5898,7 @@ public override async Task Select_optional_navigation_property_string_concat(boo
AssertSql(
"""
-SELECT COALESCE([l].[Name], N'') + N' ' + COALESCE(CASE
+SELECT ISNULL([l].[Name], N'') + N' ' + ISNULL(CASE
WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Level2_Name]
ELSE N'NULL'
END, N'')
@@ -8388,7 +8388,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3
END AS [Id0], CASE
WHEN [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l4].[Id]
END AS [Id1], CASE
- WHEN COALESCE((
+ WHEN ISNULL((
SELECT MAX(CASE
WHEN [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l5].[Id]
END)
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs
index 018d20fb4b7..633ed27f3f3 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs
@@ -413,7 +413,7 @@ public override async Task Grouping_by_all_columns_with_aggregate_function_works
AssertSql(
"""
-SELECT [a].[Id], COALESCE(SUM([a].[Id]), 0) AS [Sum], COUNT(*) AS [Count]
+SELECT [a].[Id], ISNULL(SUM([a].[Id]), 0) AS [Sum], COUNT(*) AS [Count]
FROM [ArubaOwner] AS [a]
GROUP BY [a].[Id], [a].[Alias], [a].[FirstName], [a].[LastName]
""");
@@ -722,7 +722,7 @@ ORDER BY [p].[FirstName]
LEFT JOIN (
SELECT [p2].[FirstName], [p2].[FullName], [p2].[c]
FROM (
- SELECT [p0].[FirstName], COALESCE([p0].[FirstName], N'') + N' ' + COALESCE([p0].[MiddleInitial], N'') + N' ' + COALESCE([p0].[LastName], N'') AS [FullName], 1 AS [c], ROW_NUMBER() OVER(PARTITION BY [p0].[FirstName] ORDER BY [p0].[Id]) AS [row]
+ SELECT [p0].[FirstName], ISNULL([p0].[FirstName], N'') + N' ' + ISNULL([p0].[MiddleInitial], N'') + N' ' + ISNULL([p0].[LastName], N'') AS [FullName], 1 AS [c], ROW_NUMBER() OVER(PARTITION BY [p0].[FirstName] ORDER BY [p0].[Id]) AS [row]
FROM [Person] AS [p0]
) AS [p2]
WHERE [p2].[row] <= 1
@@ -785,7 +785,7 @@ public override async Task Sum_Grouped_from_LINQ_101(bool async)
AssertSql(
"""
-SELECT [p].[Category], COALESCE(SUM([p].[UnitsInStock]), 0) AS [TotalUnitsInStock]
+SELECT [p].[Category], ISNULL(SUM([p].[UnitsInStock]), 0) AS [TotalUnitsInStock]
FROM [ProductForLinq] AS [p]
GROUP BY [p].[Category]
""");
@@ -810,7 +810,7 @@ public override async Task Whats_new_2021_sample_9(bool async)
AssertSql(
"""
SELECT [p].[FirstName] AS [Feet], (
- SELECT COALESCE(SUM([f].[Size]), 0)
+ SELECT ISNULL(SUM([f].[Size]), 0)
FROM [Person] AS [p0]
LEFT JOIN [Feet] AS [f] ON [p0].[Id] = [f].[Id]
WHERE [p].[FirstName] = [p0].[FirstName] OR ([p].[FirstName] IS NULL AND [p0].[FirstName] IS NULL)) AS [Total]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs
index 77fd634944c..0d89621b890 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs
@@ -609,10 +609,10 @@ public override async Task Where_enum_has_flag_subquery(bool async)
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
FROM [Gears] AS [g]
-WHERE [g].[Rank] & COALESCE((
+WHERE [g].[Rank] & ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
- ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE((
+ ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)
@@ -621,10 +621,10 @@ FROM [Gears] AS [g0]
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
FROM [Gears] AS [g]
-WHERE 2 & COALESCE((
+WHERE 2 & ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
- ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE((
+ ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)
@@ -1064,7 +1064,7 @@ public override async Task Select_null_propagation_optimization8(bool async)
AssertSql(
"""
-SELECT COALESCE([g].[LeaderNickname], N'') + COALESCE([g].[LeaderNickname], N'')
+SELECT ISNULL([g].[LeaderNickname], N'') + ISNULL([g].[LeaderNickname], N'')
FROM [Gears] AS [g]
""");
}
@@ -1469,7 +1469,7 @@ public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool as
AssertSql(
"""
-SELECT TOP(1) COALESCE([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
+SELECT TOP(1) ISNULL([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
ORDER BY [w].[Id]
@@ -1484,7 +1484,7 @@ public override async Task Where_subquery_boolean(bool async)
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
FROM [Gears] AS [g]
-WHERE COALESCE((
+WHERE ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -1516,7 +1516,7 @@ public override async Task Where_subquery_distinct_firstordefault_boolean(bool a
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
FROM [Gears] AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -1574,7 +1574,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean1(bool
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
FROM [Gears] AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -1593,7 +1593,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
FROM [Gears] AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit)) = CAST(1 AS bit)
@@ -1668,7 +1668,7 @@ public override async Task Where_subquery_distinct_orderby_firstordefault_boolea
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank]
FROM [Gears] AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -2152,7 +2152,7 @@ public override async Task Unicode_string_literals_is_used_for_non_unicode_colum
"""
SELECT [c].[Name], [c].[Location], [c].[Nation]
FROM [Cities] AS [c]
-WHERE COALESCE([c].[Location], N'') + N'Added' LIKE N'%Add%'
+WHERE ISNULL([c].[Location], N'') + N'Added' LIKE N'%Add%'
""");
}
@@ -2290,7 +2290,7 @@ public override async Task Coalesce_operator_in_predicate(bool async)
SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note]
FROM [Tags] AS [t]
LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]
-WHERE COALESCE([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ISNULL([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -2303,7 +2303,7 @@ public override async Task Coalesce_operator_in_predicate_with_other_conditions(
SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note]
FROM [Tags] AS [t]
LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]
-WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -2314,7 +2314,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions
AssertSql(
"""
SELECT CASE
- WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
+ WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END
FROM [Tags] AS [t]
@@ -3029,7 +3029,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo
AssertSql(
"""
-SELECT COALESCE(SUM([g].[SquadId]), 0)
+SELECT ISNULL(SUM([g].[SquadId]), 0)
FROM [Gears] AS [g]
LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId]
WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL
@@ -4055,11 +4055,11 @@ public override async Task ToString_nullable_enum_property_projection(bool async
await base.ToString_nullable_enum_property_projection(async);
AssertSql(
-"""
+ """
SELECT CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END
FROM [Weapons] AS [w]
""");
@@ -4082,13 +4082,13 @@ public override async Task ToString_nullable_enum_contains(bool async)
await base.ToString_nullable_enum_contains(async);
AssertSql(
-"""
+ """
SELECT [w].[Name]
FROM [Weapons] AS [w]
WHERE CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END LIKE N'%Cart%'
""");
}
@@ -5177,7 +5177,7 @@ public override async Task Negated_bool_ternary_inside_anonymous_type_in_project
"""
SELECT CASE
WHEN [g].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit)
- ELSE COALESCE([g].[HasSoulPatch], CAST(1 AS bit))
+ ELSE ISNULL([g].[HasSoulPatch], CAST(1 AS bit))
END ^ CAST(1 AS bit) AS [c]
FROM [Tags] AS [t]
LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]
@@ -5386,7 +5386,7 @@ public override async Task Project_one_value_type_from_empty_collection(bool asy
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [SquadId]
@@ -5439,7 +5439,7 @@ public override async Task Filter_on_subquery_projecting_one_value_type_from_emp
"""
SELECT [s].[Name]
FROM [Squads] AS [s]
-WHERE [s].[Name] = N'Kilo' AND COALESCE((
+WHERE [s].[Name] = N'Kilo' AND ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) <> 0
@@ -5452,7 +5452,7 @@ public override async Task Select_subquery_projecting_single_constant_int(bool a
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) 42
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [Gear]
@@ -5480,7 +5480,7 @@ public override async Task Select_subquery_projecting_single_constant_bool(bool
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) CAST(1 AS bit)
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), CAST(0 AS bit)) AS [Gear]
@@ -5639,7 +5639,7 @@ public override async Task Include_collection_with_complex_OrderBy3(bool async)
FROM [Gears] AS [g]
LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]
WHERE [g].[Discriminator] = N'Officer'
-ORDER BY COALESCE((
+ORDER BY ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -5685,7 +5685,7 @@ FROM [Gears] AS [g1]
ORDER BY (
SELECT COUNT(*)
FROM [Weapons] AS [w]
- WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = COALESCE((
+ WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = ISNULL((
SELECT TOP(1) [g0].[HasSoulPatch]
FROM [Gears] AS [g0]
WHERE [g0].[Nickname] = N'Marcus'), CAST(0 AS bit))), [g].[Nickname], [g].[SquadId], [g2].[Nickname]
@@ -5710,7 +5710,7 @@ public override async Task Select_subquery_boolean(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -5740,7 +5740,7 @@ public override async Task Select_subquery_int_with_inside_cast_and_coalesce(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -5755,7 +5755,7 @@ public override async Task Select_subquery_int_with_outside_cast_and_coalesce(bo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -5770,7 +5770,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce(bool a
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -5785,7 +5785,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce2(bool
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -5804,7 +5804,7 @@ public override async Task Select_subquery_boolean_empty(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'
@@ -5834,7 +5834,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean1(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -5852,7 +5852,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit))
@@ -5885,7 +5885,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -5903,7 +5903,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'), CAST(0 AS bit))
@@ -6092,7 +6092,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + CAST(5 AS nvarchar(max))
+ORDER BY ISNULL([w0].[Name], N'') + CAST(5 AS nvarchar(max))
""");
}
@@ -6105,7 +6105,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + N'Marcus'' Lancer'
+ORDER BY ISNULL([w0].[Name], N'') + N'Marcus'' Lancer'
""");
}
@@ -6115,7 +6115,7 @@ public override async Task String_concat_on_various_types(bool async)
AssertSql(
"""
-SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
+SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + ISNULL(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
FROM [Gears] AS [g]
CROSS JOIN [Missions] AS [m]
ORDER BY [g].[Nickname], [m].[Id]
@@ -6151,7 +6151,7 @@ public override async Task GroupBy_Property_Include_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([g].[SquadId]), 0)
+SELECT ISNULL(SUM([g].[SquadId]), 0)
FROM [Gears] AS [g]
GROUP BY [g].[Rank]
""");
@@ -6358,7 +6358,7 @@ public override async Task GetValueOrDefault_in_projection(bool async)
AssertSql(
"""
-SELECT COALESCE([w].[SynergyWithId], 0)
+SELECT ISNULL([w].[SynergyWithId], 0)
FROM [Weapons] AS [w]
""");
}
@@ -6371,7 +6371,7 @@ public override async Task GetValueOrDefault_in_filter(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], 0) = 0
+WHERE ISNULL([w].[SynergyWithId], 0) = 0
""");
}
@@ -6395,7 +6395,7 @@ public override async Task GetValueOrDefault_in_order_by(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-ORDER BY COALESCE([w].[SynergyWithId], 0), [w].[Id]
+ORDER BY ISNULL([w].[SynergyWithId], 0), [w].[Id]
""");
}
@@ -6407,7 +6407,7 @@ public override async Task GetValueOrDefault_with_argument(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], [w].[Id]) = 1
+WHERE ISNULL([w].[SynergyWithId], [w].[Id]) = 1
""");
}
@@ -6419,7 +6419,7 @@ public override async Task GetValueOrDefault_with_argument_complex(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
+WHERE ISNULL([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
""");
}
@@ -7238,7 +7238,7 @@ public override async Task Complex_GroupBy_after_set_operator(bool async)
AssertSql(
"""
-SELECT [u].[Name], [u].[Count], COALESCE(SUM([u].[Count]), 0) AS [Sum]
+SELECT [u].[Name], [u].[Count], ISNULL(SUM([u].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -7264,7 +7264,7 @@ public override async Task Complex_GroupBy_after_set_operator_using_result_selec
AssertSql(
"""
-SELECT [u].[Name], [u].[Count], COALESCE(SUM([u].[Count]), 0) AS [Sum]
+SELECT [u].[Name], [u].[Count], ISNULL(SUM([u].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -8234,7 +8234,7 @@ public override async Task Coalesce_used_with_non_unicode_string_column_and_cons
AssertSql(
"""
-SELECT COALESCE([c].[Location], 'Unknown')
+SELECT ISNULL([c].[Location], 'Unknown')
FROM [Cities] AS [c]
""");
}
@@ -8375,7 +8375,7 @@ public override async Task FirstOrDefault_over_int_compared_to_zero(bool async)
"""
SELECT [s].[Name]
FROM [Squads] AS [s]
-WHERE [s].[Name] = N'Delta' AND COALESCE((
+WHERE [s].[Name] = N'Delta' AND ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)
@@ -8459,14 +8459,14 @@ public override async Task FirstOrDefault_on_empty_collection_of_DateTime_in_sub
AssertSql(
"""
-SELECT [g].[Nickname], COALESCE((
+SELECT [g].[Nickname], ISNULL((
SELECT TOP(1) [t1].[IssueDate]
FROM [Tags] AS [t1]
WHERE [t1].[GearNickName] = [g].[FullName]
ORDER BY [t1].[Id]), '0001-01-01T00:00:00.0000000') AS [invalidTagIssueDate]
FROM [Gears] AS [g]
LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId]
-WHERE [t].[IssueDate] > COALESCE((
+WHERE [t].[IssueDate] > ISNULL((
SELECT TOP(1) [t0].[IssueDate]
FROM [Tags] AS [t0]
WHERE [t0].[GearNickName] = [g].[FullName]
@@ -9606,7 +9606,7 @@ public override async Task GroupBy_Select_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] AS [m]
GROUP BY [m].[CodeName]
""");
@@ -9618,7 +9618,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool
AssertSql(
"""
-SELECT [g].[FullName] + N'' + COALESCE([g].[LeaderNickname], N'') + N''
+SELECT [g].[FullName] + N'' + ISNULL([g].[LeaderNickname], N'') + N''
FROM [Gears] AS [g]
""");
}
@@ -9724,7 +9724,7 @@ public override async Task Sum_with_no_data_nullable_double(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] AS [m]
WHERE [m].[CodeName] = N'Operation Foobar'
""");
@@ -10277,7 +10277,7 @@ public override async Task Set_operator_with_navigation_in_projection_groupby_ag
AssertSql(
"""
SELECT [s].[Name], (
- SELECT COALESCE(SUM(CAST(LEN([c].[Location]) AS int)), 0)
+ SELECT ISNULL(SUM(CAST(LEN([c].[Location]) AS int)), 0)
FROM [Gears] AS [g2]
INNER JOIN [Squads] AS [s0] ON [g2].[SquadId] = [s0].[Id]
INNER JOIN [Cities] AS [c] ON [g2].[CityOfBirthName] = [c].[Name]
@@ -10361,7 +10361,7 @@ LEFT JOIN (
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row]
FROM [Weapons] AS [w]
) AS [w0]
- WHERE [w0].[row] <= COALESCE((
+ WHERE [w0].[row] <= ISNULL((
SELECT [n].[value]
FROM OPENJSON(@__numbers_0) WITH ([value] int '$') AS [n]
ORDER BY [n].[value]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs
index 386c1fe322a..2bf0859b7f3 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs
@@ -201,7 +201,7 @@ public override async Task Skip_navigation_select_many_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([s].[Key1]), 0)
+SELECT ISNULL(SUM([s].[Key1]), 0)
FROM [EntityRoots] AS [e]
INNER JOIN (
SELECT [e1].[Key1], [e0].[RootSkipSharedId]
@@ -264,7 +264,7 @@ public override async Task Skip_navigation_select_subquery_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([e1].[Id]), 0)
+ SELECT ISNULL(SUM([e1].[Id]), 0)
FROM [EntityOneEntityTwo] AS [e0]
INNER JOIN [EntityOnes] AS [e1] ON [e0].[OneSkipSharedId] = [e1].[Id]
WHERE [e].[Id] = [e0].[TwoSkipSharedId])
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs
index 6b8a8b282d5..0b4bd7d743a 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs
@@ -200,7 +200,7 @@ public override async Task Skip_navigation_select_many_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([s].[Key1]), 0)
+SELECT ISNULL(SUM([s].[Key1]), 0)
FROM [EntityRoots] AS [e]
INNER JOIN (
SELECT [e1].[Key1], [e0].[RootSkipSharedId]
@@ -263,7 +263,7 @@ public override async Task Skip_navigation_select_subquery_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([e1].[Id]), 0)
+ SELECT ISNULL(SUM([e1].[Id]), 0)
FROM [EntityOneEntityTwo] AS [e0]
INNER JOIN [EntityOnes] AS [e1] ON [e0].[OneSkipSharedId] = [e1].[Id]
WHERE [e].[Id] = [e0].[TwoSkipSharedId])
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs
index 4db5547df79..b414cd3ee3c 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs
@@ -106,7 +106,7 @@ public override async Task Sum_over_empty_returns_zero(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [o].[OrderID] = 42
""");
@@ -154,7 +154,7 @@ public override async Task Average_after_default_if_empty_does_not_throw(bool as
AssertSql(
"""
-SELECT AVG(CAST(COALESCE([o0].[OrderID], 0) AS float))
+SELECT AVG(CAST(ISNULL([o0].[OrderID], 0) AS float))
FROM (
SELECT 1 AS empty
) AS [e]
@@ -172,7 +172,7 @@ public override async Task Max_after_default_if_empty_does_not_throw(bool async)
AssertSql(
"""
-SELECT MAX(COALESCE([o0].[OrderID], 0))
+SELECT MAX(ISNULL([o0].[OrderID], 0))
FROM (
SELECT 1 AS empty
) AS [e]
@@ -190,7 +190,7 @@ public override async Task Min_after_default_if_empty_does_not_throw(bool async)
AssertSql(
"""
-SELECT MIN(COALESCE([o0].[OrderID], 0))
+SELECT MIN(ISNULL([o0].[OrderID], 0))
FROM (
SELECT 1 AS empty
) AS [e]
@@ -208,7 +208,7 @@ public override async Task Sum_with_no_data_cast_to_nullable(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [o].[OrderID] < 0
""");
@@ -220,7 +220,7 @@ public override async Task Sum_with_no_data_nullable(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([p].[SupplierID]), 0)
+SELECT ISNULL(SUM([p].[SupplierID]), 0)
FROM [Products] AS [p]
""");
}
@@ -231,7 +231,7 @@ public override async Task Sum_with_no_arg_empty(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [o].[OrderID] = 42
""");
@@ -628,7 +628,7 @@ public override async Task Sum_with_no_arg(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
""");
}
@@ -639,7 +639,7 @@ public override async Task Sum_with_binary_expression(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID] * 2), 0)
+SELECT ISNULL(SUM([o].[OrderID] * 2), 0)
FROM [Orders] AS [o]
""");
}
@@ -650,7 +650,7 @@ public override async Task Sum_with_arg(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
""");
}
@@ -661,7 +661,7 @@ public override async Task Sum_with_arg_expression(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID] + [o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID] + [o].[OrderID]), 0)
FROM [Orders] AS [o]
""");
}
@@ -672,7 +672,7 @@ public override async Task Sum_with_division_on_decimal(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(CAST([o].[Quantity] AS decimal(18,2)) / 2.09), 0.0)
+SELECT ISNULL(SUM(CAST([o].[Quantity] AS decimal(18,2)) / 2.09), 0.0)
FROM [Order Details] AS [o]
""");
}
@@ -683,7 +683,7 @@ public override async Task Sum_with_division_on_decimal_no_significant_digits(bo
AssertSql(
"""
-SELECT COALESCE(SUM(CAST([o].[Quantity] AS decimal(18,2)) / 2.0), 0.0)
+SELECT ISNULL(SUM(CAST([o].[Quantity] AS decimal(18,2)) / 2.0), 0.0)
FROM [Order Details] AS [o]
""");
}
@@ -694,7 +694,7 @@ public override async Task Sum_with_coalesce(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(COALESCE([p].[UnitPrice], 0.0)), 0.0)
+SELECT ISNULL(SUM(ISNULL([p].[UnitPrice], 0.0)), 0.0)
FROM [Products] AS [p]
WHERE [p].[ProductID] < 40
""");
@@ -710,8 +710,8 @@ public override async Task Sum_over_subquery_is_client_eval(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM((
- SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM((
+ SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID])), 0)
FROM [Customers] AS [c]
@@ -728,9 +728,9 @@ public override async Task Sum_over_nested_subquery_is_client_eval(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM((
- SELECT COALESCE(SUM(5 + (
- SELECT COALESCE(SUM([o0].[ProductID]), 0)
+SELECT ISNULL(SUM((
+ SELECT ISNULL(SUM(5 + (
+ SELECT ISNULL(SUM([o0].[ProductID]), 0)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID])), 0)
FROM [Orders] AS [o]
@@ -749,8 +749,8 @@ public override async Task Sum_over_min_subquery_is_client_eval(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM((
- SELECT COALESCE(SUM(5 + (
+SELECT ISNULL(SUM((
+ SELECT ISNULL(SUM(5 + (
SELECT MIN([o0].[ProductID])
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID])), 0)
@@ -766,7 +766,7 @@ public override async Task Sum_on_float_column(bool async)
AssertSql(
"""
-SELECT CAST(COALESCE(SUM([o].[Discount]), 0.0E0) AS real)
+SELECT CAST(ISNULL(SUM([o].[Discount]), 0.0E0) AS real)
FROM [Order Details] AS [o]
WHERE [o].[ProductID] = 1
""");
@@ -779,7 +779,7 @@ public override async Task Sum_on_float_column_in_subquery(bool async)
AssertSql(
"""
SELECT [o].[OrderID], (
- SELECT CAST(COALESCE(SUM([o0].[Discount]), 0.0E0) AS real)
+ SELECT CAST(ISNULL(SUM([o0].[Discount]), 0.0E0) AS real)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID]) AS [Sum]
FROM [Orders] AS [o]
@@ -859,7 +859,7 @@ public override async Task Average_with_coalesce(bool async)
AssertSql(
"""
-SELECT AVG(COALESCE([p].[UnitPrice], 0.0))
+SELECT AVG(ISNULL([p].[UnitPrice], 0.0))
FROM [Products] AS [p]
WHERE [p].[ProductID] < 40
""");
@@ -876,7 +876,7 @@ public override async Task Average_over_subquery_is_client_eval(bool async)
AssertSql(
"""
SELECT AVG(CAST((
- SELECT COALESCE(SUM([o].[OrderID]), 0)
+ SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]) AS float))
FROM [Customers] AS [c]
@@ -1007,7 +1007,7 @@ public override async Task Min_with_coalesce(bool async)
AssertSql(
"""
-SELECT MIN(COALESCE([p].[UnitPrice], 0.0))
+SELECT MIN(ISNULL([p].[UnitPrice], 0.0))
FROM [Products] AS [p]
WHERE [p].[ProductID] < 40
""");
@@ -1024,7 +1024,7 @@ public override async Task Min_over_subquery_is_client_eval(bool async)
AssertSql(
"""
SELECT MIN((
- SELECT COALESCE(SUM([o].[OrderID]), 0)
+ SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]))
FROM [Customers] AS [c]
@@ -1113,7 +1113,7 @@ public override async Task Max_with_coalesce(bool async)
AssertSql(
"""
-SELECT MAX(COALESCE([p].[UnitPrice], 0.0))
+SELECT MAX(ISNULL([p].[UnitPrice], 0.0))
FROM [Products] AS [p]
WHERE [p].[ProductID] < 40
""");
@@ -1130,7 +1130,7 @@ public override async Task Max_over_subquery_is_client_eval(bool async)
AssertSql(
"""
SELECT MAX((
- SELECT COALESCE(SUM([o].[OrderID]), 0)
+ SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]))
FROM [Customers] AS [c]
@@ -1178,7 +1178,7 @@ public override async Task Max_over_sum_subquery_is_client_eval(bool async)
SELECT MAX((
SELECT MAX(5 + (
- SELECT COALESCE(SUM([o0].[ProductID]), 0)
+ SELECT ISNULL(SUM([o0].[ProductID]), 0)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID]))
FROM [Orders] AS [o]
@@ -2633,7 +2633,7 @@ public override async Task Project_constant_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(1), 0)
+SELECT ISNULL(SUM(1), 0)
FROM [Employees] AS [e]
""");
}
@@ -2863,7 +2863,7 @@ public override async Task Sum_over_explicit_cast_over_column(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(CAST([o].[OrderID] AS bigint)), CAST(0 AS bigint))
+SELECT ISNULL(SUM(CAST([o].[OrderID] AS bigint)), CAST(0 AS bigint))
FROM [Orders] AS [o]
""");
}
@@ -2975,7 +2975,7 @@ public override async Task Contains_inside_Sum_without_GroupBy(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(CASE
+SELECT ISNULL(SUM(CASE
WHEN [c].[City] IN (N'London', N'Berlin') THEN 1
ELSE 0
END), 0)
@@ -3084,8 +3084,8 @@ public override async Task Type_casting_inside_sum(bool async)
await base.Type_casting_inside_sum(async);
AssertSql(
-"""
-SELECT COALESCE(SUM(CAST([o].[Discount] AS decimal(18,2))), 0.0)
+ """
+SELECT ISNULL(SUM(CAST([o].[Discount] AS decimal(18,2))), 0.0)
FROM [Order Details] AS [o]
""");
}
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs
index 0676b4a7b45..37c99135fc6 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs
@@ -861,7 +861,7 @@ await AssertCount(
"""
SELECT COUNT(*)
FROM [Orders] AS [o]
-WHERE CAST(ISDATE(COALESCE([o].[CustomerID], N'') + CAST([o].[OrderID] AS nvarchar(max))) AS bit) = CAST(1 AS bit)
+WHERE CAST(ISDATE(ISNULL([o].[CustomerID], N'') + CAST([o].[OrderID] AS nvarchar(max))) AS bit) = CAST(1 AS bit)
""");
}
@@ -934,7 +934,7 @@ await AssertCount(
"""
SELECT COUNT(*)
FROM [Orders] AS [o]
-WHERE ISNUMERIC(COALESCE([o].[CustomerID], N'') + CAST([o].[OrderID] AS nvarchar(max))) = 1
+WHERE ISNUMERIC(ISNULL([o].[CustomerID], N'') + CAST([o].[OrderID] AS nvarchar(max))) = 1
""");
}
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs
index 7b6b52694d4..86237a017fd 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs
@@ -362,7 +362,7 @@ public override async Task String_Join_over_non_nullable_column(bool async)
AssertSql(
"""
-SELECT [c].[City], COALESCE(STRING_AGG([c].[CustomerID], N'|'), N'') AS [Customers]
+SELECT [c].[City], ISNULL(STRING_AGG([c].[CustomerID], N'|'), N'') AS [Customers]
FROM [Customers] AS [c]
GROUP BY [c].[City]
""");
@@ -375,7 +375,7 @@ public override async Task String_Join_over_nullable_column(bool async)
AssertSql(
"""
-SELECT [c].[City], COALESCE(STRING_AGG(COALESCE([c].[Region], N''), N'|'), N'') AS [Regions]
+SELECT [c].[City], ISNULL(STRING_AGG(ISNULL([c].[Region], N''), N'|'), N'') AS [Regions]
FROM [Customers] AS [c]
GROUP BY [c].[City]
""");
@@ -388,7 +388,7 @@ public override async Task String_Join_with_predicate(bool async)
AssertSql(
"""
-SELECT [c].[City], COALESCE(STRING_AGG(CASE
+SELECT [c].[City], ISNULL(STRING_AGG(CASE
WHEN CAST(LEN([c].[ContactName]) AS int) > 10 THEN [c].[CustomerID]
END, N'|'), N'') AS [Customers]
FROM [Customers] AS [c]
@@ -403,7 +403,7 @@ public override async Task String_Join_with_ordering(bool async)
AssertSql(
"""
-SELECT [c].[City], COALESCE(STRING_AGG([c].[CustomerID], N'|') WITHIN GROUP (ORDER BY [c].[CustomerID] DESC), N'') AS [Customers]
+SELECT [c].[City], ISNULL(STRING_AGG([c].[CustomerID], N'|') WITHIN GROUP (ORDER BY [c].[CustomerID] DESC), N'') AS [Customers]
FROM [Customers] AS [c]
GROUP BY [c].[City]
""");
@@ -431,7 +431,7 @@ public override async Task String_Concat(bool async)
AssertSql(
"""
-SELECT [c].[City], COALESCE(STRING_AGG([c].[CustomerID], N''), N'') AS [Customers]
+SELECT [c].[City], ISNULL(STRING_AGG([c].[CustomerID], N''), N'') AS [Customers]
FROM [Customers] AS [c]
GROUP BY [c].[City]
""");
@@ -1140,7 +1140,7 @@ public override async Task Sum_over_round_works_correctly_in_projection(bool asy
AssertSql(
"""
SELECT [o].[OrderID], (
- SELECT COALESCE(SUM(ROUND([o0].[UnitPrice], 2)), 0.0)
+ SELECT ISNULL(SUM(ROUND([o0].[UnitPrice], 2)), 0.0)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID]) AS [Sum]
FROM [Orders] AS [o]
@@ -1155,7 +1155,7 @@ public override async Task Sum_over_round_works_correctly_in_projection_2(bool a
AssertSql(
"""
SELECT [o].[OrderID], (
- SELECT COALESCE(SUM(ROUND([o0].[UnitPrice] * [o0].[UnitPrice], 2)), 0.0)
+ SELECT ISNULL(SUM(ROUND([o0].[UnitPrice] * [o0].[UnitPrice], 2)), 0.0)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID]) AS [Sum]
FROM [Orders] AS [o]
@@ -1170,7 +1170,7 @@ public override async Task Sum_over_truncate_works_correctly_in_projection(bool
AssertSql(
"""
SELECT [o].[OrderID], (
- SELECT COALESCE(SUM(ROUND([o0].[UnitPrice], 0, 1)), 0.0)
+ SELECT ISNULL(SUM(ROUND([o0].[UnitPrice], 0, 1)), 0.0)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID]) AS [Sum]
FROM [Orders] AS [o]
@@ -1185,7 +1185,7 @@ public override async Task Sum_over_truncate_works_correctly_in_projection_2(boo
AssertSql(
"""
SELECT [o].[OrderID], (
- SELECT COALESCE(SUM(ROUND([o0].[UnitPrice] * [o0].[UnitPrice], 0, 1)), 0.0)
+ SELECT ISNULL(SUM(ROUND([o0].[UnitPrice] * [o0].[UnitPrice], 0, 1)), 0.0)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID]) AS [Sum]
FROM [Orders] AS [o]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs
index b0bd1c81497..9ae5efdf7cc 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs
@@ -123,7 +123,7 @@ public override async Task GroupBy_Property_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -135,7 +135,7 @@ public override async Task GroupBy_Property_Select_Sum_Min_Max_Avg(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -207,7 +207,7 @@ public override async Task GroupBy_Property_Select_Key_Sum(bool async)
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COALESCE(SUM([o].[OrderID]), 0) AS [Sum]
+SELECT [o].[CustomerID] AS [Key], ISNULL(SUM([o].[OrderID]), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -219,7 +219,7 @@ public override async Task GroupBy_Property_Select_Key_Sum_Min_Max_Avg(bool asyn
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT [o].[CustomerID] AS [Key], ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -231,7 +231,7 @@ public override async Task GroupBy_Property_Select_Sum_Min_Key_Max_Avg(bool asyn
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID] AS [Key], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID] AS [Key], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -243,7 +243,7 @@ public override async Task GroupBy_Property_Select_key_multiple_times_and_aggreg
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key1], COALESCE(SUM([o].[OrderID]), 0) AS [Sum]
+SELECT [o].[CustomerID] AS [Key1], ISNULL(SUM([o].[OrderID]), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -272,7 +272,7 @@ public override async Task GroupBy_aggregate_projecting_conditional_expression(b
"""
SELECT [o].[OrderDate] AS [Key], CASE
WHEN COUNT(*) = 0 THEN 1
- ELSE COALESCE(SUM(CASE
+ ELSE ISNULL(SUM(CASE
WHEN [o].[OrderID] % 2 = 0 THEN 1
ELSE 0
END), 0) / COUNT(*)
@@ -291,7 +291,7 @@ public override async Task GroupBy_aggregate_projecting_conditional_expression_b
SELECT CASE
WHEN [o].[OrderDate] IS NULL THEN N'is null'
ELSE N'is not null'
-END AS [Key], COALESCE(SUM([o].[OrderID]), 0) AS [Sum]
+END AS [Key], ISNULL(SUM([o].[OrderID]), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[OrderDate]
""");
@@ -363,7 +363,7 @@ public override async Task GroupBy_anonymous_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -375,7 +375,7 @@ public override async Task GroupBy_anonymous_Select_Sum_Min_Max_Avg(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -387,7 +387,7 @@ public override async Task GroupBy_anonymous_with_alias_Select_Key_Sum(bool asyn
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COALESCE(SUM([o].[OrderID]), 0) AS [Sum]
+SELECT [o].[CustomerID] AS [Key], ISNULL(SUM([o].[OrderID]), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -459,7 +459,7 @@ public override async Task GroupBy_Composite_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -471,7 +471,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_Max_Avg(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -543,7 +543,7 @@ public override async Task GroupBy_Composite_Select_Key_Sum(bool async)
AssertSql(
"""
-SELECT [o].[CustomerID], [o].[EmployeeID], COALESCE(SUM([o].[OrderID]), 0) AS [Sum]
+SELECT [o].[CustomerID], [o].[EmployeeID], ISNULL(SUM([o].[OrderID]), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -555,7 +555,7 @@ public override async Task GroupBy_Composite_Select_Key_Sum_Min_Max_Avg(bool asy
AssertSql(
"""
-SELECT [o].[CustomerID], [o].[EmployeeID], COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT [o].[CustomerID], [o].[EmployeeID], ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -567,7 +567,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_Key_Max_Avg(bool asy
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID], [o].[EmployeeID], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID], [o].[EmployeeID], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -579,7 +579,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_Key_flattened_Max_Av
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID], [o].[EmployeeID], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID], [o].[EmployeeID], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -591,7 +591,7 @@ public override async Task GroupBy_Dto_as_key_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID], [o].[EmployeeID]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID], [o].[EmployeeID]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -603,7 +603,7 @@ public override async Task GroupBy_Dto_as_element_selector_Select_Sum(bool async
AssertSql(
"""
-SELECT COALESCE(SUM(CAST([o].[EmployeeID] AS bigint)), CAST(0 AS bigint)) AS [Sum], [o].[CustomerID] AS [Key]
+SELECT ISNULL(SUM(CAST([o].[EmployeeID] AS bigint)), CAST(0 AS bigint)) AS [Sum], [o].[CustomerID] AS [Key]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -615,7 +615,7 @@ public override async Task GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Ma
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID] AS [CustomerId], [o].[EmployeeID] AS [EmployeeId], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID] AS [CustomerId], [o].[EmployeeID] AS [EmployeeId], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -627,7 +627,7 @@ public override async Task GroupBy_Composite_Select_Sum_Min_part_Key_flattened_M
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], [o].[CustomerID], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID], [o].[EmployeeID]
""");
@@ -639,7 +639,7 @@ public override async Task GroupBy_Constant_Select_Sum_Min_Key_Max_Avg(bool asyn
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum], MIN([o0].[OrderID]) AS [Min], [o0].[Key], MAX([o0].[OrderID]) AS [Max], AVG(CAST([o0].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum], MIN([o0].[OrderID]) AS [Min], [o0].[Key], MAX([o0].[OrderID]) AS [Max], AVG(CAST([o0].[OrderID] AS float)) AS [Avg]
FROM (
SELECT [o].[OrderID], 2 AS [Key]
FROM [Orders] AS [o]
@@ -654,7 +654,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum(boo
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum]
FROM (
SELECT [o].[OrderID], 2 AS [Key]
FROM [Orders] AS [o]
@@ -669,7 +669,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum2(bo
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum]
FROM (
SELECT [o].[OrderID], 2 AS [Key]
FROM [Orders] AS [o]
@@ -684,7 +684,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum3(bo
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum]
FROM (
SELECT [o].[OrderID], 2 AS [Key]
FROM [Orders] AS [o]
@@ -699,7 +699,7 @@ public override async Task GroupBy_after_predicate_Constant_Select_Sum_Min_Key_M
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum], MIN([o0].[OrderID]) AS [Min], [o0].[Key] AS [Random], MAX([o0].[OrderID]) AS [Max], AVG(CAST([o0].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum], MIN([o0].[OrderID]) AS [Min], [o0].[Key] AS [Random], MAX([o0].[OrderID]) AS [Max], AVG(CAST([o0].[OrderID] AS float)) AS [Avg]
FROM (
SELECT [o].[OrderID], 2 AS [Key]
FROM [Orders] AS [o]
@@ -715,7 +715,7 @@ public override async Task GroupBy_Constant_with_element_selector_Select_Sum_Min
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum], [o0].[Key]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum], [o0].[Key]
FROM (
SELECT [o].[OrderID], 2 AS [Key]
FROM [Orders] AS [o]
@@ -734,7 +734,7 @@ SELECT MIN(CASE
WHEN 1 = [o0].[Key] THEN [o0].[OrderDate]
END) AS [Min], MAX(CASE
WHEN 1 = [o0].[Key] THEN [o0].[OrderDate]
-END) AS [Max], COALESCE(SUM(CASE
+END) AS [Max], ISNULL(SUM(CASE
WHEN 1 = [o0].[Key] THEN [o0].[OrderID]
END), 0) AS [Sum], AVG(CASE
WHEN 1 = [o0].[Key] THEN CAST([o0].[OrderID] AS float)
@@ -756,7 +756,7 @@ public override async Task GroupBy_param_Select_Sum_Min_Key_Max_Avg(bool async)
"""
@__a_0='2'
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum], MIN([o0].[OrderID]) AS [Min], [o0].[Key], MAX([o0].[OrderID]) AS [Max], AVG(CAST([o0].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum], MIN([o0].[OrderID]) AS [Min], [o0].[Key], MAX([o0].[OrderID]) AS [Max], AVG(CAST([o0].[OrderID] AS float)) AS [Avg]
FROM (
SELECT [o].[OrderID], @__a_0 AS [Key]
FROM [Orders] AS [o]
@@ -773,7 +773,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum(bool a
"""
@__a_0='2'
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum]
FROM (
SELECT [o].[OrderID], @__a_0 AS [Key]
FROM [Orders] AS [o]
@@ -790,7 +790,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum2(bool
"""
@__a_0='2'
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum]
FROM (
SELECT [o].[OrderID], @__a_0 AS [Key]
FROM [Orders] AS [o]
@@ -807,7 +807,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum3(bool
"""
@__a_0='2'
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum]
FROM (
SELECT [o].[OrderID], @__a_0 AS [Key]
FROM [Orders] AS [o]
@@ -824,7 +824,7 @@ public override async Task GroupBy_param_with_element_selector_Select_Sum_Min_Ke
"""
@__a_0='2'
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum], [o0].[Key]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum], [o0].[Key]
FROM (
SELECT [o].[OrderID], @__a_0 AS [Key]
FROM [Orders] AS [o]
@@ -915,7 +915,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Sum(bool asy
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -927,7 +927,7 @@ public override async Task GroupBy_Property_scalar_element_selector_Sum_Min_Max_
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -999,7 +999,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Sum(bool
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1011,7 +1011,7 @@ public override async Task GroupBy_Property_anonymous_element_selector_Sum_Min_M
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[EmployeeID]) AS [Min], MAX([o].[EmployeeID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[EmployeeID]) AS [Min], MAX([o].[EmployeeID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1023,7 +1023,7 @@ public override async Task GroupBy_element_selector_complex_aggregate(bool async
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID] + 1), 0)
+SELECT ISNULL(SUM([o].[OrderID] + 1), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1035,7 +1035,7 @@ public override async Task GroupBy_element_selector_complex_aggregate2(bool asyn
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID] + 1), 0)
+SELECT ISNULL(SUM([o].[OrderID] + 1), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1047,7 +1047,7 @@ public override async Task GroupBy_element_selector_complex_aggregate3(bool asyn
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID] + 1), 0)
+SELECT ISNULL(SUM([o].[OrderID] + 1), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1059,7 +1059,7 @@ public override async Task GroupBy_element_selector_complex_aggregate4(bool asyn
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID] + 1), 0)
+SELECT ISNULL(SUM([o].[OrderID] + 1), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1071,7 +1071,7 @@ public override async Task Element_selector_with_case_block_repeated_inside_anot
AssertSql(
"""
-SELECT [o].[OrderID], COALESCE(SUM(CASE
+SELECT [o].[OrderID], ISNULL(SUM(CASE
WHEN [o].[CustomerID] = N'ALFKI' THEN CASE
WHEN [o].[OrderID] > 1000 THEN [o].[OrderID]
ELSE -[o].[OrderID]
@@ -1107,7 +1107,7 @@ public override async Task GroupBy_empty_key_Aggregate(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0)
+SELECT ISNULL(SUM([o0].[OrderID]), 0)
FROM (
SELECT [o].[OrderID], 1 AS [Key]
FROM [Orders] AS [o]
@@ -1122,7 +1122,7 @@ public override async Task GroupBy_empty_key_Aggregate_Key(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0) AS [Sum]
+SELECT ISNULL(SUM([o0].[OrderID]), 0) AS [Sum]
FROM (
SELECT [o].[OrderID], 1 AS [Key]
FROM [Orders] AS [o]
@@ -1137,7 +1137,7 @@ public override async Task OrderBy_GroupBy_Aggregate(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0)
+SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1459,7 +1459,7 @@ public override async Task Select_anonymous_GroupBy_Aggregate(bool async)
AssertSql(
"""
-SELECT MIN([o].[OrderDate]) AS [Min], MAX([o].[OrderDate]) AS [Max], COALESCE(SUM([o].[OrderID]), 0) AS [Sum], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT MIN([o].[OrderDate]) AS [Min], MAX([o].[OrderDate]) AS [Max], ISNULL(SUM([o].[OrderID]), 0) AS [Sum], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
WHERE [o].[OrderID] < 10300
GROUP BY [o].[CustomerID]
@@ -1516,8 +1516,8 @@ public override async Task GroupBy_complex_key_aggregate_2(bool async)
AssertSql(
"""
-SELECT [o0].[Key] AS [Month], COALESCE(SUM([o0].[OrderID]), 0) AS [Total], (
- SELECT COALESCE(SUM([o1].[OrderID]), 0)
+SELECT [o0].[Key] AS [Month], ISNULL(SUM([o0].[OrderID]), 0) AS [Total], (
+ SELECT ISNULL(SUM([o1].[OrderID]), 0)
FROM [Orders] AS [o1]
WHERE DATEPART(month, [o1].[OrderDate]) = [o0].[Key] OR ([o1].[OrderDate] IS NULL AND [o0].[Key] IS NULL)) AS [Payment]
FROM (
@@ -1572,7 +1572,7 @@ public override async Task GroupBy_OrderBy_count_Select_sum(bool async)
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COALESCE(SUM([o].[OrderID]), 0) AS [Sum]
+SELECT [o].[CustomerID] AS [Key], ISNULL(SUM([o].[OrderID]), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
ORDER BY COUNT(*), [o].[CustomerID]
@@ -1731,7 +1731,7 @@ public override async Task GroupBy_filter_count_OrderBy_count_Select_sum(bool as
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COUNT(*) AS [Count], COALESCE(SUM([o].[OrderID]), 0) AS [Sum]
+SELECT [o].[CustomerID] AS [Key], COUNT(*) AS [Count], ISNULL(SUM([o].[OrderID]), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
HAVING COUNT(*) > 4
@@ -1927,7 +1927,7 @@ public override async Task GroupBy_with_result_selector(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
+SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], MIN([o].[OrderID]) AS [Min], MAX([o].[OrderID]) AS [Max], AVG(CAST([o].[OrderID] AS float)) AS [Avg]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1939,7 +1939,7 @@ public override async Task GroupBy_Sum_constant(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(1), 0)
+SELECT ISNULL(SUM(1), 0)
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -1951,7 +1951,7 @@ public override async Task GroupBy_Sum_constant_cast(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(CAST(1 AS bigint)), CAST(0 AS bigint))
+SELECT ISNULL(SUM(CAST(1 AS bigint)), CAST(0 AS bigint))
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -2132,7 +2132,7 @@ public override async Task GroupBy_Where_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM(CASE
+SELECT ISNULL(SUM(CASE
WHEN [o].[OrderID] < 10300 THEN [o].[OrderID]
END), 0)
FROM [Orders] AS [o]
@@ -2218,10 +2218,10 @@ public override async Task GroupBy_multiple_Sum_with_conditional_projection(bool
AssertSql(
"""
-SELECT [o].[CustomerID], COALESCE(SUM(CASE
+SELECT [o].[CustomerID], ISNULL(SUM(CASE
WHEN [o].[OrderID] < 11000 THEN [o].[OrderID]
ELSE 0
-END), 0) AS [TenK], COALESCE(SUM(CASE
+END), 0) AS [TenK], ISNULL(SUM(CASE
WHEN [o].[OrderID] >= 11000 THEN [o].[OrderID]
ELSE 0
END), 0) AS [EleventK]
@@ -2236,10 +2236,10 @@ public override async Task GroupBy_multiple_Sum_with_Select_conditional_projecti
AssertSql(
"""
-SELECT [o].[CustomerID], COALESCE(SUM(CASE
+SELECT [o].[CustomerID], ISNULL(SUM(CASE
WHEN [o].[OrderID] < 11000 THEN [o].[OrderID]
ELSE 0
-END), 0) AS [TenK], COALESCE(SUM(CASE
+END), 0) AS [TenK], ISNULL(SUM(CASE
WHEN [o].[OrderID] >= 11000 THEN [o].[OrderID]
ELSE 0
END), 0) AS [EleventK]
@@ -2475,7 +2475,7 @@ public override async Task GroupBy_Select_Distinct_aggregate(bool async)
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], AVG(DISTINCT (CAST([o].[OrderID] AS float))) AS [Average], COUNT(DISTINCT ([o].[EmployeeID])) AS [Count], COUNT_BIG(DISTINCT ([o].[EmployeeID])) AS [LongCount], MAX(DISTINCT ([o].[OrderDate])) AS [Max], MIN(DISTINCT ([o].[OrderDate])) AS [Min], COALESCE(SUM(DISTINCT ([o].[OrderID])), 0) AS [Sum]
+SELECT [o].[CustomerID] AS [Key], AVG(DISTINCT (CAST([o].[OrderID] AS float))) AS [Average], COUNT(DISTINCT ([o].[EmployeeID])) AS [Count], COUNT_BIG(DISTINCT ([o].[EmployeeID])) AS [LongCount], MAX(DISTINCT ([o].[OrderDate])) AS [Max], MIN(DISTINCT ([o].[OrderDate])) AS [Min], ISNULL(SUM(DISTINCT ([o].[OrderID])), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -2515,7 +2515,7 @@ public override async Task MinMax_after_GroupBy_aggregate(bool async)
"""
SELECT MIN([o0].[c])
FROM (
- SELECT COALESCE(SUM([o].[OrderID]), 0) AS [c]
+ SELECT ISNULL(SUM([o].[OrderID]), 0) AS [c]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
) AS [o0]
@@ -2524,7 +2524,7 @@ GROUP BY [o].[CustomerID]
"""
SELECT MAX([o0].[c])
FROM (
- SELECT COALESCE(SUM([o].[OrderID]), 0) AS [c]
+ SELECT ISNULL(SUM([o].[OrderID]), 0) AS [c]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
) AS [o0]
@@ -2559,7 +2559,7 @@ WHEN NOT EXISTS (
SELECT 1
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
- HAVING COALESCE(SUM([o].[OrderID]), 0) < 0) THEN CAST(1 AS bit)
+ HAVING ISNULL(SUM([o].[OrderID]), 0) < 0) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END
""");
@@ -2699,7 +2699,7 @@ public override async Task GroupBy_aggregate_followed_by_another_GroupBy_aggrega
AssertSql(
"""
-SELECT [o1].[Key0] AS [Key], COALESCE(SUM([o1].[Count]), 0) AS [Count]
+SELECT [o1].[Key0] AS [Key], ISNULL(SUM([o1].[Count]), 0) AS [Count]
FROM (
SELECT [o0].[Count], 1 AS [Key0]
FROM (
@@ -2803,7 +2803,7 @@ public override async Task Odata_groupby_empty_key(bool async)
AssertSql(
"""
-SELECT N'TotalAmount' AS [Name], COALESCE(SUM(CAST([o0].[OrderID] AS decimal(18,2))), 0.0) AS [Value]
+SELECT N'TotalAmount' AS [Name], ISNULL(SUM(CAST([o0].[OrderID] AS decimal(18,2))), 0.0) AS [Value]
FROM (
SELECT [o].[OrderID], 1 AS [Key]
FROM [Orders] AS [o]
@@ -2818,7 +2818,7 @@ public override async Task GroupBy_with_group_key_access_thru_navigation(bool as
AssertSql(
"""
-SELECT [o0].[CustomerID] AS [Key], COALESCE(SUM([o].[OrderID]), 0) AS [Aggregate]
+SELECT [o0].[CustomerID] AS [Key], ISNULL(SUM([o].[OrderID]), 0) AS [Aggregate]
FROM [Order Details] AS [o]
INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID]
GROUP BY [o0].[CustomerID]
@@ -2831,7 +2831,7 @@ public override async Task GroupBy_with_group_key_access_thru_nested_navigation(
AssertSql(
"""
-SELECT [c].[Country] AS [Key], COALESCE(SUM([o].[OrderID]), 0) AS [Aggregate]
+SELECT [c].[Country] AS [Key], ISNULL(SUM([o].[OrderID]), 0) AS [Aggregate]
FROM [Order Details] AS [o]
INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID]
LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID]
@@ -2845,7 +2845,7 @@ public override async Task GroupBy_with_group_key_being_navigation(bool async)
AssertSql(
"""
-SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], COALESCE(SUM([o].[OrderID]), 0) AS [Aggregate]
+SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], ISNULL(SUM([o].[OrderID]), 0) AS [Aggregate]
FROM [Order Details] AS [o]
INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID]
GROUP BY [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate]
@@ -2858,7 +2858,7 @@ public override async Task GroupBy_with_group_key_being_nested_navigation(bool a
AssertSql(
"""
-SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], COALESCE(SUM([o].[OrderID]), 0) AS [Aggregate]
+SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], ISNULL(SUM([o].[OrderID]), 0) AS [Aggregate]
FROM [Order Details] AS [o]
INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID]
LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID]
@@ -2894,7 +2894,7 @@ public override async Task GroupBy_with_order_by_skip_and_another_order_by(bool
"""
@__p_0='80'
-SELECT COALESCE(SUM([o0].[OrderID]), 0)
+SELECT ISNULL(SUM([o0].[OrderID]), 0)
FROM (
SELECT [o].[OrderID], [o].[CustomerID]
FROM [Orders] AS [o]
@@ -2939,7 +2939,7 @@ public override async Task GroupBy_orderby_projection_with_coalesce_operation(bo
AssertSql(
"""
-SELECT COALESCE([c].[City], N'Unknown') AS [Locality], COUNT(*) AS [Count]
+SELECT ISNULL([c].[City], N'Unknown') AS [Locality], COUNT(*) AS [Count]
FROM [Customers] AS [c]
GROUP BY [c].[City]
ORDER BY COUNT(*) DESC, [c].[City]
@@ -3208,7 +3208,7 @@ public override async Task GroupBy_with_cast_inside_grouping_aggregate(bool asyn
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COUNT(*) AS [Count], COALESCE(SUM(CAST([o].[OrderID] AS bigint)), CAST(0 AS bigint)) AS [Sum]
+SELECT [o].[CustomerID] AS [Key], COUNT(*) AS [Count], ISNULL(SUM(CAST([o].[OrderID] AS bigint)), CAST(0 AS bigint)) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -3223,7 +3223,7 @@ public override async Task Complex_query_with_groupBy_in_subquery1(bool async)
SELECT [c].[CustomerID], [o0].[Sum], [o0].[CustomerID]
FROM [Customers] AS [c]
OUTER APPLY (
- SELECT COALESCE(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID]
+ SELECT ISNULL(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID]
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]
GROUP BY [o].[CustomerID]
@@ -3241,7 +3241,7 @@ public override async Task Complex_query_with_groupBy_in_subquery2(bool async)
SELECT [c].[CustomerID], [o0].[Max], [o0].[Sum], [o0].[CustomerID]
FROM [Customers] AS [c]
OUTER APPLY (
- SELECT MAX(CAST(LEN([o].[CustomerID]) AS int)) AS [Max], COALESCE(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID]
+ SELECT MAX(CAST(LEN([o].[CustomerID]) AS int)) AS [Max], ISNULL(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID]
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]
GROUP BY [o].[CustomerID]
@@ -3259,7 +3259,7 @@ public override async Task Complex_query_with_groupBy_in_subquery3(bool async)
SELECT [c].[CustomerID], [o0].[Max], [o0].[Sum], [o0].[CustomerID]
FROM [Customers] AS [c]
OUTER APPLY (
- SELECT MAX(CAST(LEN([o].[CustomerID]) AS int)) AS [Max], COALESCE(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID]
+ SELECT MAX(CAST(LEN([o].[CustomerID]) AS int)) AS [Max], ISNULL(SUM([o].[OrderID]), 0) AS [Sum], [o].[CustomerID]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
) AS [o0]
@@ -3285,10 +3285,10 @@ public override async Task Where_select_function_groupby_followed_by_another_sel
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COALESCE(SUM(CASE
+SELECT [o].[CustomerID] AS [Key], ISNULL(SUM(CASE
WHEN 2020 - DATEPART(year, [o].[OrderDate]) <= 30 THEN [o].[OrderID]
ELSE 0
-END), 0) AS [Sum1], COALESCE(SUM(CASE
+END), 0) AS [Sum1], ISNULL(SUM(CASE
WHEN 2020 - DATEPART(year, [o].[OrderDate]) > 30 AND 2020 - DATEPART(year, [o].[OrderDate]) <= 60 THEN [o].[OrderID]
ELSE 0
END), 0) AS [Sum2]
@@ -3330,7 +3330,7 @@ public override async Task Group_by_with_arithmetic_operation_inside_aggregate(b
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COALESCE(SUM([o].[OrderID] + CAST(LEN([o].[CustomerID]) AS int)), 0) AS [Sum]
+SELECT [o].[CustomerID] AS [Key], ISNULL(SUM([o].[OrderID] + CAST(LEN([o].[CustomerID]) AS int)), 0) AS [Sum]
FROM [Orders] AS [o]
GROUP BY [o].[CustomerID]
""");
@@ -3416,7 +3416,7 @@ public override async Task GroupBy_aggregate_from_multiple_query_in_same_project
AssertSql(
"""
-SELECT [o].[CustomerID] AS [Key], COALESCE((
+SELECT [o].[CustomerID] AS [Key], ISNULL((
SELECT TOP(1) COUNT(*) + MIN([o].[OrderID])
FROM [Employees] AS [e]
WHERE [e].[City] = N'Seattle'
@@ -3541,7 +3541,7 @@ public override async Task Complex_query_with_group_by_in_subquery5(bool async)
"""
SELECT [s].[c], [s].[ProductID], [c1].[CustomerID], [c1].[City]
FROM (
- SELECT COALESCE(SUM([o].[ProductID] + [o].[OrderID] * 1000), 0) AS [c], [o].[ProductID], MIN([o].[OrderID] / 100) AS [c0]
+ SELECT ISNULL(SUM([o].[ProductID] + [o].[OrderID] * 1000), 0) AS [c], [o].[ProductID], MIN([o].[OrderID] / 100) AS [c0]
FROM [Order Details] AS [o]
INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID]
LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID]
@@ -3566,18 +3566,18 @@ public override async Task Complex_query_with_groupBy_in_subquery4(bool async)
SELECT [c].[CustomerID], [s1].[Sum], [s1].[Count], [s1].[Key]
FROM [Customers] AS [c]
OUTER APPLY (
- SELECT COALESCE(SUM([s].[OrderID]), 0) AS [Sum], (
+ SELECT ISNULL(SUM([s].[OrderID]), 0) AS [Sum], (
SELECT COUNT(*)
FROM (
- SELECT [o0].[CustomerID], COALESCE([c1].[City], N'') + COALESCE([o0].[CustomerID], N'') AS [Key]
+ SELECT [o0].[CustomerID], ISNULL([c1].[City], N'') + ISNULL([o0].[CustomerID], N'') AS [Key]
FROM [Orders] AS [o0]
LEFT JOIN [Customers] AS [c1] ON [o0].[CustomerID] = [c1].[CustomerID]
WHERE [c].[CustomerID] = [o0].[CustomerID]
) AS [s0]
LEFT JOIN [Customers] AS [c2] ON [s0].[CustomerID] = [c2].[CustomerID]
- WHERE ([s].[Key] = [s0].[Key] OR ([s].[Key] IS NULL AND [s0].[Key] IS NULL)) AND COALESCE([c2].[City], N'') + COALESCE([s0].[CustomerID], N'') LIKE N'Lon%') AS [Count], [s].[Key]
+ WHERE ([s].[Key] = [s0].[Key] OR ([s].[Key] IS NULL AND [s0].[Key] IS NULL)) AND ISNULL([c2].[City], N'') + ISNULL([s0].[CustomerID], N'') LIKE N'Lon%') AS [Count], [s].[Key]
FROM (
- SELECT [o].[OrderID], COALESCE([c0].[City], N'') + COALESCE([o].[CustomerID], N'') AS [Key]
+ SELECT [o].[OrderID], ISNULL([c0].[City], N'') + ISNULL([o].[CustomerID], N'') AS [Key]
FROM [Orders] AS [o]
LEFT JOIN [Customers] AS [c0] ON [o].[CustomerID] = [c0].[CustomerID]
WHERE [c].[CustomerID] = [o].[CustomerID]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs
index 48c3758e51a..5d004e9a257 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs
@@ -713,7 +713,7 @@ public override async Task SelectMany_with_selecting_outer_element(bool async)
SELECT [o0].[c]
FROM [Customers] AS [c]
CROSS APPLY (
- SELECT [c].[CustomerID] + COALESCE([c].[City], N'') AS [c]
+ SELECT [c].[CustomerID] + ISNULL([c].[City], N'') AS [c]
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]
) AS [o0]
@@ -750,7 +750,7 @@ FROM [Customers] AS [c]
INNER JOIN (
SELECT [c1].[CustomerID], [c1].[Address], [c1].[City], [c1].[CompanyName], [c1].[ContactName], [c1].[ContactTitle], [c1].[Country], [c1].[Fax], [c1].[Phone], [c1].[PostalCode], [c1].[Region]
FROM (
- SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + COALESCE([c0].[City], N'')) AS [row]
+ SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + ISNULL([c0].[City], N'')) AS [row]
FROM [Customers] AS [c0]
) AS [c1]
WHERE [c1].[row] <= 2
@@ -772,7 +772,7 @@ FROM [Customers] AS [c]
INNER JOIN (
SELECT [c1].[CustomerID], [c1].[Address], [c1].[City], [c1].[CompanyName], [c1].[ContactName], [c1].[ContactTitle], [c1].[Country], [c1].[Fax], [c1].[Phone], [c1].[PostalCode], [c1].[Region]
FROM (
- SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + COALESCE([c0].[City], N'')) AS [row]
+ SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + ISNULL([c0].[City], N'')) AS [row]
FROM [Customers] AS [c0]
) AS [c1]
WHERE [c1].[row] <= 2
@@ -794,7 +794,7 @@ FROM [Customers] AS [c]
INNER JOIN (
SELECT [c1].[CustomerID], [c1].[Address], [c1].[City], [c1].[CompanyName], [c1].[ContactName], [c1].[ContactTitle], [c1].[Country], [c1].[Fax], [c1].[Phone], [c1].[PostalCode], [c1].[Region]
FROM (
- SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + COALESCE([c0].[City], N'')) AS [row]
+ SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + ISNULL([c0].[City], N'')) AS [row]
FROM [Customers] AS [c0]
) AS [c1]
WHERE [c1].[row] <= 2
@@ -819,7 +819,7 @@ ORDER BY [c].[CustomerID]
INNER JOIN (
SELECT [c1].[CustomerID], [c1].[Address], [c1].[City], [c1].[CompanyName], [c1].[ContactName], [c1].[ContactTitle], [c1].[Country], [c1].[Fax], [c1].[Phone], [c1].[PostalCode], [c1].[Region]
FROM (
- SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + COALESCE([c0].[City], N'')) AS [row]
+ SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], ROW_NUMBER() OVER(PARTITION BY [c0].[CustomerID] ORDER BY [c0].[CustomerID] + ISNULL([c0].[City], N'')) AS [row]
FROM [Customers] AS [c0]
) AS [c1]
WHERE [c1].[row] <= 2
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs
index 09fc604d175..f48eedff47d 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs
@@ -148,7 +148,7 @@ public override async Task KeylessEntity_groupby(bool async)
AssertSql(
"""
-SELECT [m].[City] AS [Key], COUNT(*) AS [Count], COALESCE(SUM(CAST(LEN([m].[Address]) AS int)), 0) AS [Sum]
+SELECT [m].[City] AS [Key], COUNT(*) AS [Count], ISNULL(SUM(CAST(LEN([m].[Address]) AS int)), 0) AS [Sum]
FROM (
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c]
) AS [m]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs
index 047d9c29e53..6ab4b27775d 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs
@@ -467,7 +467,7 @@ public override async Task Default_if_empty_top_level_projection(bool async)
AssertSql(
"""
-SELECT COALESCE([e1].[EmployeeID], 0)
+SELECT ISNULL([e1].[EmployeeID], 0)
FROM (
SELECT 1 AS empty
) AS [e0]
@@ -1141,7 +1141,7 @@ public override async Task Join_Customers_Orders_Projection_With_String_Concat_S
@__p_0='10'
@__p_1='5'
-SELECT COALESCE([c].[ContactName], N'') + N' ' + COALESCE([c].[ContactTitle], N'') AS [Contact], [o].[OrderID]
+SELECT ISNULL([c].[ContactName], N'') + N' ' + ISNULL([c].[ContactTitle], N'') AS [Contact], [o].[OrderID]
FROM [Customers] AS [c]
INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]
ORDER BY [o].[OrderID]
@@ -2763,7 +2763,7 @@ public override async Task OrderBy_null_coalesce_operator(bool async)
"""
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
FROM [Customers] AS [c]
-ORDER BY COALESCE([c].[Region], N'ZZ'), [c].[CustomerID]
+ORDER BY ISNULL([c].[Region], N'ZZ'), [c].[CustomerID]
""");
}
@@ -2804,6 +2804,17 @@ FROM [Customers] AS [c]
""");
}
+ public override async Task Coalesce_Correct_Type(bool async)
+ {
+ await base.Coalesce_Correct_Type(async);
+
+ AssertSql(
+ """
+SELECT COALESCE([c].[Region], N'no region specified')
+FROM [Customers] AS [c]
+""");
+ }
+
public override async Task Null_Coalesce_Short_Circuit_with_server_correlated_leftover(bool async)
{
await base.Null_Coalesce_Short_Circuit_with_server_correlated_leftover(async);
@@ -2848,7 +2859,7 @@ public override async Task Projection_null_coalesce_operator(bool async)
AssertSql(
"""
-SELECT [c].[CustomerID], [c].[CompanyName], COALESCE([c].[Region], N'ZZ') AS [Region]
+SELECT [c].[CustomerID], [c].[CompanyName], ISNULL([c].[Region], N'ZZ') AS [Region]
FROM [Customers] AS [c]
""");
}
@@ -2861,7 +2872,7 @@ public override async Task Filter_coalesce_operator(bool async)
"""
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
FROM [Customers] AS [c]
-WHERE COALESCE([c].[ContactName], [c].[CompanyName]) = N'Liz Nixon'
+WHERE ISNULL([c].[ContactName], [c].[CompanyName]) = N'Liz Nixon'
""");
}
@@ -2878,9 +2889,9 @@ public override async Task Take_skip_null_coalesce_operator(bool async)
FROM (
SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region]
FROM (
- SELECT TOP(@__p_0) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], COALESCE([c].[Region], N'ZZ') AS [c]
+ SELECT TOP(@__p_0) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], ISNULL([c].[Region], N'ZZ') AS [c]
FROM [Customers] AS [c]
- ORDER BY COALESCE([c].[Region], N'ZZ')
+ ORDER BY ISNULL([c].[Region], N'ZZ')
) AS [c0]
ORDER BY [c0].[c]
OFFSET @__p_1 ROWS
@@ -2906,11 +2917,11 @@ public override async Task Select_take_skip_null_coalesce_operator(bool async)
@__p_0='10'
@__p_1='5'
-SELECT [c0].[CustomerID], [c0].[CompanyName], COALESCE([c0].[Region], N'ZZ') AS [Region]
+SELECT [c0].[CustomerID], [c0].[CompanyName], ISNULL([c0].[Region], N'ZZ') AS [Region]
FROM (
- SELECT TOP(@__p_0) [c].[CustomerID], [c].[CompanyName], [c].[Region], COALESCE([c].[Region], N'ZZ') AS [c]
+ SELECT TOP(@__p_0) [c].[CustomerID], [c].[CompanyName], [c].[Region], ISNULL([c].[Region], N'ZZ') AS [c]
FROM [Customers] AS [c]
- ORDER BY COALESCE([c].[Region], N'ZZ')
+ ORDER BY ISNULL([c].[Region], N'ZZ')
) AS [c0]
ORDER BY [c0].[c]
OFFSET @__p_1 ROWS
@@ -2928,9 +2939,9 @@ public override async Task Select_take_skip_null_coalesce_operator2(bool async)
SELECT [c0].[CustomerID], [c0].[CompanyName], [c0].[Region]
FROM (
- SELECT TOP(@__p_0) [c].[CustomerID], [c].[CompanyName], [c].[Region], COALESCE([c].[Region], N'ZZ') AS [c]
+ SELECT TOP(@__p_0) [c].[CustomerID], [c].[CompanyName], [c].[Region], ISNULL([c].[Region], N'ZZ') AS [c]
FROM [Customers] AS [c]
- ORDER BY COALESCE([c].[Region], N'ZZ')
+ ORDER BY ISNULL([c].[Region], N'ZZ')
) AS [c0]
ORDER BY [c0].[c]
OFFSET @__p_1 ROWS
@@ -2948,9 +2959,9 @@ public override async Task Select_take_skip_null_coalesce_operator3(bool async)
SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region]
FROM (
- SELECT TOP(@__p_0) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], COALESCE([c].[Region], N'ZZ') AS [c]
+ SELECT TOP(@__p_0) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], ISNULL([c].[Region], N'ZZ') AS [c]
FROM [Customers] AS [c]
- ORDER BY COALESCE([c].[Region], N'ZZ')
+ ORDER BY ISNULL([c].[Region], N'ZZ')
) AS [c0]
ORDER BY [c0].[c]
OFFSET @__p_1 ROWS
@@ -2965,7 +2976,7 @@ public override async Task Selected_column_can_coalesce(bool async)
"""
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
FROM [Customers] AS [c]
-ORDER BY COALESCE([c].[Region], N'ZZ')
+ORDER BY ISNULL([c].[Region], N'ZZ')
""");
}
@@ -3050,7 +3061,7 @@ public override async Task Concat_string_int(bool async)
AssertSql(
"""
-SELECT CAST([o].[OrderID] AS nvarchar(max)) + COALESCE([o].[CustomerID], N'')
+SELECT CAST([o].[OrderID] AS nvarchar(max)) + ISNULL([o].[CustomerID], N'')
FROM [Orders] AS [o]
""");
}
@@ -3061,7 +3072,7 @@ public override async Task Concat_int_string(bool async)
AssertSql(
"""
-SELECT COALESCE([o].[CustomerID], N'') + CAST([o].[OrderID] AS nvarchar(max))
+SELECT ISNULL([o].[CustomerID], N'') + CAST([o].[OrderID] AS nvarchar(max))
FROM [Orders] AS [o]
""");
}
@@ -3096,7 +3107,7 @@ public override async Task String_concat_with_navigation1(bool async)
AssertSql(
"""
-SELECT COALESCE([o].[CustomerID], N'') + N' ' + COALESCE([c].[City], N'')
+SELECT ISNULL([o].[CustomerID], N'') + N' ' + ISNULL([c].[City], N'')
FROM [Orders] AS [o]
LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID]
""");
@@ -3108,7 +3119,7 @@ public override async Task String_concat_with_navigation2(bool async)
AssertSql(
"""
-SELECT COALESCE([c].[City], N'') + N' ' + COALESCE([c].[City], N'')
+SELECT ISNULL([c].[City], N'') + N' ' + ISNULL([c].[City], N'')
FROM [Orders] AS [o]
LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID]
""");
@@ -3867,7 +3878,7 @@ public override async Task OrderBy_coalesce_take_distinct(bool async)
FROM (
SELECT TOP(@__p_0) [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock]
FROM [Products] AS [p]
- ORDER BY COALESCE([p].[UnitPrice], 0.0)
+ ORDER BY ISNULL([p].[UnitPrice], 0.0)
) AS [p0]
""");
}
@@ -3885,7 +3896,7 @@ public override async Task OrderBy_coalesce_skip_take_distinct(bool async)
FROM (
SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock]
FROM [Products] AS [p]
- ORDER BY COALESCE([p].[UnitPrice], 0.0)
+ ORDER BY ISNULL([p].[UnitPrice], 0.0)
OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY
) AS [p0]
""");
@@ -3904,7 +3915,7 @@ SELECT DISTINCT TOP(@__p_0) [p0].[ProductID], [p0].[Discontinued], [p0].[Product
FROM (
SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock]
FROM [Products] AS [p]
- ORDER BY COALESCE([p].[UnitPrice], 0.0)
+ ORDER BY ISNULL([p].[UnitPrice], 0.0)
OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY
) AS [p0]
""");
@@ -4110,9 +4121,9 @@ public override async Task Anonymous_complex_distinct_where(bool async)
AssertSql(
"""
-SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [A]
+SELECT DISTINCT [c].[CustomerID] + ISNULL([c].[City], N'') AS [A]
FROM [Customers] AS [c]
-WHERE [c].[CustomerID] + COALESCE([c].[City], N'') = N'ALFKIBerlin'
+WHERE [c].[CustomerID] + ISNULL([c].[City], N'') = N'ALFKIBerlin'
""");
}
@@ -4124,7 +4135,7 @@ public override async Task Anonymous_complex_distinct_orderby(bool async)
"""
SELECT [c0].[A]
FROM (
- SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [A]
+ SELECT DISTINCT [c].[CustomerID] + ISNULL([c].[City], N'') AS [A]
FROM [Customers] AS [c]
) AS [c0]
ORDER BY [c0].[A]
@@ -4139,9 +4150,9 @@ public override async Task Anonymous_complex_distinct_result(bool async)
"""
SELECT COUNT(*)
FROM (
- SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [A]
+ SELECT DISTINCT [c].[CustomerID] + ISNULL([c].[City], N'') AS [A]
FROM [Customers] AS [c]
- WHERE [c].[CustomerID] + COALESCE([c].[City], N'') LIKE N'A%'
+ WHERE [c].[CustomerID] + ISNULL([c].[City], N'') LIKE N'A%'
) AS [c0]
""");
}
@@ -4152,9 +4163,9 @@ public override async Task Anonymous_complex_orderby(bool async)
AssertSql(
"""
-SELECT [c].[CustomerID] + COALESCE([c].[City], N'') AS [A]
+SELECT [c].[CustomerID] + ISNULL([c].[City], N'') AS [A]
FROM [Customers] AS [c]
-ORDER BY [c].[CustomerID] + COALESCE([c].[City], N'')
+ORDER BY [c].[CustomerID] + ISNULL([c].[City], N'')
""");
}
@@ -4230,9 +4241,9 @@ public override async Task DTO_complex_distinct_where(bool async)
AssertSql(
"""
-SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [Property]
+SELECT DISTINCT [c].[CustomerID] + ISNULL([c].[City], N'') AS [Property]
FROM [Customers] AS [c]
-WHERE [c].[CustomerID] + COALESCE([c].[City], N'') = N'ALFKIBerlin'
+WHERE [c].[CustomerID] + ISNULL([c].[City], N'') = N'ALFKIBerlin'
""");
}
@@ -4244,7 +4255,7 @@ public override async Task DTO_complex_distinct_orderby(bool async)
"""
SELECT [c0].[Property]
FROM (
- SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [Property]
+ SELECT DISTINCT [c].[CustomerID] + ISNULL([c].[City], N'') AS [Property]
FROM [Customers] AS [c]
) AS [c0]
ORDER BY [c0].[Property]
@@ -4259,9 +4270,9 @@ public override async Task DTO_complex_distinct_result(bool async)
"""
SELECT COUNT(*)
FROM (
- SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [Property]
+ SELECT DISTINCT [c].[CustomerID] + ISNULL([c].[City], N'') AS [Property]
FROM [Customers] AS [c]
- WHERE [c].[CustomerID] + COALESCE([c].[City], N'') LIKE N'A%'
+ WHERE [c].[CustomerID] + ISNULL([c].[City], N'') LIKE N'A%'
) AS [c0]
""");
}
@@ -4489,7 +4500,7 @@ public override async Task Select_take_sum(bool async)
"""
@__p_0='10'
-SELECT COALESCE(SUM([o0].[OrderID]), 0)
+SELECT ISNULL(SUM([o0].[OrderID]), 0)
FROM (
SELECT TOP(@__p_0) [o].[OrderID]
FROM [Orders] AS [o]
@@ -4632,7 +4643,7 @@ public override async Task Select_skip_sum(bool async)
"""
@__p_0='10'
-SELECT COALESCE(SUM([o0].[OrderID]), 0)
+SELECT ISNULL(SUM([o0].[OrderID]), 0)
FROM (
SELECT [o].[OrderID]
FROM [Orders] AS [o]
@@ -4718,7 +4729,7 @@ public override async Task Select_distinct_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([o0].[OrderID]), 0)
+SELECT ISNULL(SUM([o0].[OrderID]), 0)
FROM (
SELECT DISTINCT [o].[OrderID]
FROM [Orders] AS [o]
@@ -5788,7 +5799,7 @@ public override async Task DefaultIfEmpty_Sum_over_collection_navigation(bool as
AssertSql(
"""
SELECT [c].[CustomerID], (
- SELECT COALESCE(SUM(COALESCE([o0].[OrderID], 0)), 0)
+ SELECT ISNULL(SUM(ISNULL([o0].[OrderID], 0)), 0)
FROM (
SELECT 1 AS empty
) AS [e]
@@ -7213,7 +7224,7 @@ public override async Task Subquery_with_navigation_inside_inline_collection(boo
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
FROM [Customers] AS [c]
WHERE (
- SELECT COALESCE(SUM([v].[Value]), 0)
+ SELECT ISNULL(SUM([v].[Value]), 0)
FROM (VALUES (CAST(100 AS int)), ((
SELECT COUNT(*)
FROM [Orders] AS [o]
@@ -7299,7 +7310,7 @@ public override async Task Contains_over_concatenated_columns_both_fixed_length(
SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate]
FROM [Orders] AS [o]
LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID]
-WHERE COALESCE([o].[CustomerID], N'') + COALESCE([c].[CustomerID], N'') IN (
+WHERE ISNULL([o].[CustomerID], N'') + ISNULL([c].[CustomerID], N'') IN (
SELECT [d].[value]
FROM OPENJSON(@__data_0) WITH ([value] nchar(10) '$') AS [d]
)
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs
index 6fab28fb8c7..b852ef8c1b4 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs
@@ -330,7 +330,7 @@ public override async Task Select_count_plus_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM(CAST([o0].[Quantity] AS int)), 0)
+ SELECT ISNULL(SUM(CAST([o0].[Quantity] AS int)), 0)
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID]) + (
SELECT COUNT(*)
@@ -711,7 +711,7 @@ public override async Task Collection_select_nav_prop_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([o].[OrderID]), 0)
+ SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]) AS [Sum]
FROM [Customers] AS [c]
@@ -725,7 +725,7 @@ public override async Task Collection_select_nav_prop_sum_plus_one(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([o].[OrderID]), 0)
+ SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]) + 1 AS [Sum]
FROM [Customers] AS [c]
@@ -741,7 +741,7 @@ public override async Task Collection_where_nav_prop_sum(bool async)
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
FROM [Customers] AS [c]
WHERE (
- SELECT COALESCE(SUM([o].[OrderID]), 0)
+ SELECT ISNULL(SUM([o].[OrderID]), 0)
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]) > 1000
""");
@@ -990,7 +990,7 @@ public override async Task Project_single_scalar_value_subquery_in_query_with_op
"""
@__p_0='3'
-SELECT [o0].[OrderID], COALESCE((
+SELECT [o0].[OrderID], ISNULL((
SELECT TOP(1) [o1].[OrderID]
FROM [Order Details] AS [o1]
WHERE [o0].[OrderID] = [o1].[OrderID]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs
index 67f7f8464cd..264c497f8e8 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs
@@ -398,7 +398,7 @@ public override async Task Select_nested_collection_multi_level4(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) (
SELECT COUNT(*)
FROM [Order Details] AS [o0]
@@ -418,8 +418,8 @@ public override async Task Select_nested_collection_multi_level5(bool async)
AssertSql(
"""
-SELECT COALESCE((
- SELECT TOP(1) COALESCE((
+SELECT ISNULL((
+ SELECT TOP(1) ISNULL((
SELECT TOP(1) [o0].[ProductID]
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID] AND ([o0].[OrderID] <> (
@@ -445,8 +445,8 @@ public override async Task Select_nested_collection_multi_level6(bool async)
AssertSql(
"""
-SELECT COALESCE((
- SELECT TOP(1) COALESCE((
+SELECT ISNULL((
+ SELECT TOP(1) ISNULL((
SELECT TOP(1) [o0].[ProductID]
FROM [Order Details] AS [o0]
WHERE [o].[OrderID] = [o0].[OrderID] AND [o0].[OrderID] <> CAST(LEN([c].[CustomerID]) AS int)
@@ -876,7 +876,7 @@ public override async Task Project_single_element_from_collection_with_OrderBy_o
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [s].[OrderID]
FROM (
SELECT TOP(1) [o0].[OrderID], [p].[ProductName]
@@ -1289,7 +1289,7 @@ public override async Task FirstOrDefault_over_empty_collection_of_value_type_re
AssertSql(
"""
-SELECT [c].[CustomerID], COALESCE((
+SELECT [c].[CustomerID], ISNULL((
SELECT TOP(1) [o].[OrderID]
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]
@@ -1562,7 +1562,7 @@ public override async Task Coalesce_over_nullable_uint(bool async)
AssertSql(
"""
-SELECT COALESCE([o].[EmployeeID], 0)
+SELECT ISNULL([o].[EmployeeID], 0)
FROM [Orders] AS [o]
""");
}
@@ -1827,7 +1827,7 @@ public override async Task Reverse_in_projection_scalar_subquery(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [o].[OrderID]
FROM [Orders] AS [o]
ORDER BY [o].[OrderDate] DESC, [o].[OrderID]), 0)
@@ -1966,7 +1966,7 @@ public override async Task Projection_take_projection_doesnt_project_intermitten
"""
@__p_0='10'
-SELECT TOP(@__p_0) [c].[CustomerID] + N' ' + COALESCE([c].[City], N'') AS [Aggregate]
+SELECT TOP(@__p_0) [c].[CustomerID] + N' ' + ISNULL([c].[City], N'') AS [Aggregate]
FROM [Customers] AS [c]
ORDER BY [c].[CustomerID]
""");
@@ -1980,7 +1980,7 @@ public override async Task Projection_skip_projection_doesnt_project_intermitten
"""
@__p_0='7'
-SELECT [c].[CustomerID] + N' ' + COALESCE([c].[City], N'') AS [Aggregate]
+SELECT [c].[CustomerID] + N' ' + ISNULL([c].[City], N'') AS [Aggregate]
FROM [Customers] AS [c]
ORDER BY [c].[CustomerID]
OFFSET @__p_0 ROWS
@@ -1993,7 +1993,7 @@ public override async Task Projection_Distinct_projection_preserves_columns_used
AssertSql(
"""
-SELECT COALESCE([c0].[FirstLetter], N'') + N' ' + [c0].[Foo] AS [Aggregate]
+SELECT ISNULL([c0].[FirstLetter], N'') + N' ' + [c0].[Foo] AS [Aggregate]
FROM (
SELECT DISTINCT [c].[CustomerID], SUBSTRING([c].[CustomerID], 0 + 1, 1) AS [FirstLetter], N'Foo' AS [Foo]
FROM [Customers] AS [c]
@@ -2009,7 +2009,7 @@ public override async Task Projection_take_predicate_projection(bool async)
"""
@__p_0='10'
-SELECT [c0].[CustomerID] + N' ' + COALESCE([c0].[City], N'') AS [Aggregate]
+SELECT [c0].[CustomerID] + N' ' + ISNULL([c0].[City], N'') AS [Aggregate]
FROM (
SELECT TOP(@__p_0) [c].[CustomerID], [c].[City]
FROM [Customers] AS [c]
@@ -2384,7 +2384,7 @@ public override async Task Client_projection_with_string_initialization_with_sca
SELECT [c].[CustomerID], (
SELECT TOP(1) [o].[OrderDate]
FROM [Orders] AS [o]
- WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 11000), [c].[City], N'test' + COALESCE([c].[City], N'')
+ WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 11000), [c].[City], N'test' + ISNULL([c].[City], N'')
FROM [Customers] AS [c]
WHERE [c].[CustomerID] LIKE N'F%'
""");
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs
index e913143e580..236ad9e048d 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs
@@ -1585,7 +1585,7 @@ public override async Task Where_concat_string_int_comparison4(bool async)
"""
SELECT [o].[CustomerID]
FROM [Orders] AS [o]
-WHERE CAST([o].[OrderID] AS nvarchar(max)) + COALESCE([o].[CustomerID], N'') = [o].[CustomerID]
+WHERE CAST([o].[OrderID] AS nvarchar(max)) + ISNULL([o].[CustomerID], N'') = [o].[CustomerID]
""");
}
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs
index db5ab5edae1..24828bc51f3 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs
@@ -2124,7 +2124,7 @@ public override async Task Where_coalesce(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE COALESCE([e].[NullableBoolA], CAST(1 AS bit)) = CAST(1 AS bit)
+WHERE ISNULL([e].[NullableBoolA], CAST(1 AS bit)) = CAST(1 AS bit)
""");
}
@@ -2148,7 +2148,7 @@ public override async Task Where_coalesce_shortcircuit_many(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE COALESCE([e].[NullableBoolA], CASE
+WHERE ISNULL([e].[NullableBoolA], CASE
WHEN [e].[BoolA] = CAST(1 AS bit) OR [e].[BoolB] = CAST(1 AS bit) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END) = CAST(1 AS bit)
@@ -2187,7 +2187,7 @@ public override async Task Where_equal_with_coalesce(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE COALESCE([e].[NullableStringA], [e].[NullableStringB]) = [e].[NullableStringC] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL AND [e].[NullableStringC] IS NULL)
+WHERE ISNULL([e].[NullableStringA], [e].[NullableStringB]) = [e].[NullableStringC] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL AND [e].[NullableStringC] IS NULL)
""");
}
@@ -2199,7 +2199,7 @@ public override async Task Where_not_equal_with_coalesce(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE (COALESCE([e].[NullableStringA], [e].[NullableStringB]) <> [e].[NullableStringC] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) OR [e].[NullableStringC] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL OR [e].[NullableStringC] IS NOT NULL)
+WHERE (ISNULL([e].[NullableStringA], [e].[NullableStringB]) <> [e].[NullableStringC] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) OR [e].[NullableStringC] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL OR [e].[NullableStringC] IS NOT NULL)
""");
}
@@ -2211,7 +2211,7 @@ public override async Task Where_equal_with_coalesce_both_sides(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE COALESCE([e].[NullableStringA], [e].[NullableStringB]) = COALESCE([e].[NullableStringC], [e].[StringA])
+WHERE ISNULL([e].[NullableStringA], [e].[NullableStringB]) = ISNULL([e].[NullableStringC], [e].[StringA])
""");
}
@@ -2223,7 +2223,7 @@ public override async Task Where_not_equal_with_coalesce_both_sides(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE (COALESCE([e].[NullableIntA], [e].[NullableIntB]) <> COALESCE([e].[NullableIntC], [e].[NullableIntB]) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) OR ([e].[NullableIntC] IS NULL AND [e].[NullableIntB] IS NULL)) AND ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL OR [e].[NullableIntC] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL)
+WHERE (ISNULL([e].[NullableIntA], [e].[NullableIntB]) <> ISNULL([e].[NullableIntC], [e].[NullableIntB]) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) OR ([e].[NullableIntC] IS NULL AND [e].[NullableIntB] IS NULL)) AND ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL OR [e].[NullableIntC] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL)
""");
}
@@ -2674,7 +2674,7 @@ public override async Task Projecting_nullable_bool_with_coalesce(bool async)
AssertSql(
"""
-SELECT [e].[Id], COALESCE([e].[NullableBoolA], CAST(0 AS bit)) AS [Coalesce]
+SELECT [e].[Id], ISNULL([e].[NullableBoolA], CAST(0 AS bit)) AS [Coalesce]
FROM [Entities1] AS [e]
""");
}
@@ -2685,12 +2685,12 @@ public override async Task Projecting_nullable_bool_with_coalesce_nested(bool as
AssertSql(
"""
-SELECT [e].[Id], COALESCE([e].[NullableBoolA], [e].[NullableBoolB], CAST(0 AS bit)) AS [Coalesce]
+SELECT [e].[Id], ISNULL(ISNULL([e].[NullableBoolA], [e].[NullableBoolB]), CAST(0 AS bit)) AS [Coalesce]
FROM [Entities1] AS [e]
""",
//
"""
-SELECT [e].[Id], COALESCE([e].[NullableBoolA], [e].[NullableBoolB], CAST(0 AS bit)) AS [Coalesce]
+SELECT [e].[Id], ISNULL(ISNULL([e].[NullableBoolA], [e].[NullableBoolB]), CAST(0 AS bit)) AS [Coalesce]
FROM [Entities1] AS [e]
""");
}
@@ -2797,25 +2797,25 @@ public override async Task Null_semantics_coalesce(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE [e].[NullableBoolA] = COALESCE([e].[NullableBoolB], [e].[BoolC])
+WHERE [e].[NullableBoolA] = ISNULL([e].[NullableBoolB], [e].[BoolC])
""",
//
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE [e].[NullableBoolA] = COALESCE([e].[NullableBoolB], [e].[NullableBoolC]) OR ([e].[NullableBoolA] IS NULL AND [e].[NullableBoolB] IS NULL AND [e].[NullableBoolC] IS NULL)
+WHERE [e].[NullableBoolA] = ISNULL([e].[NullableBoolB], [e].[NullableBoolC]) OR ([e].[NullableBoolA] IS NULL AND [e].[NullableBoolB] IS NULL AND [e].[NullableBoolC] IS NULL)
""",
//
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE COALESCE([e].[NullableBoolB], [e].[BoolC]) <> [e].[NullableBoolA] OR [e].[NullableBoolA] IS NULL
+WHERE ISNULL([e].[NullableBoolB], [e].[BoolC]) <> [e].[NullableBoolA] OR [e].[NullableBoolA] IS NULL
""",
//
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE (COALESCE([e].[NullableBoolB], [e].[NullableBoolC]) <> [e].[NullableBoolA] OR ([e].[NullableBoolB] IS NULL AND [e].[NullableBoolC] IS NULL) OR [e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NOT NULL OR [e].[NullableBoolC] IS NOT NULL OR [e].[NullableBoolA] IS NOT NULL)
+WHERE (ISNULL([e].[NullableBoolB], [e].[NullableBoolC]) <> [e].[NullableBoolA] OR ([e].[NullableBoolB] IS NULL AND [e].[NullableBoolC] IS NULL) OR [e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NOT NULL OR [e].[NullableBoolC] IS NOT NULL OR [e].[NullableBoolA] IS NOT NULL)
""");
}
@@ -2895,7 +2895,7 @@ FROM [Entities1] AS [e]
INNER JOIN [Entities2] AS [e0] ON ([e].[NullableStringA] = [e0].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e0].[NullableStringB] IS NULL)) AND CASE
WHEN ([e].[NullableStringB] <> [e].[NullableStringC] OR [e].[NullableStringB] IS NULL OR [e].[NullableStringC] IS NULL) AND ([e].[NullableStringB] IS NOT NULL OR [e].[NullableStringC] IS NOT NULL) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
-END = COALESCE([e0].[NullableBoolA], [e0].[BoolC])
+END = ISNULL([e0].[NullableBoolA], [e0].[BoolC])
""");
}
@@ -3583,7 +3583,7 @@ public override async Task Coalesce_not_equal(bool async)
"""
SELECT [e].[Id]
FROM [Entities1] AS [e]
-WHERE COALESCE([e].[NullableIntA], 0) <> 0
+WHERE ISNULL([e].[NullableIntA], 0) <> 0
""");
}
@@ -4466,7 +4466,7 @@ public override async Task Sum_function_is_always_considered_non_nullable(bool a
AssertSql(
"""
SELECT [e].[NullableIntA] AS [Key], CASE
- WHEN COALESCE(SUM([e].[IntA]), 0) <> [e].[NullableIntA] OR [e].[NullableIntA] IS NULL THEN CAST(1 AS bit)
+ WHEN ISNULL(SUM([e].[IntA]), 0) <> [e].[NullableIntA] OR [e].[NullableIntA] IS NULL THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END AS [Sum]
FROM [Entities1] AS [e]
@@ -4482,7 +4482,7 @@ public override async Task Nullability_is_computed_correctly_for_chained_coalesc
"""
SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC]
FROM [Entities1] AS [e]
-WHERE COALESCE([e].[NullableIntA], [e].[NullableIntB], [e].[IntC]) <> [e].[NullableIntC] OR [e].[NullableIntC] IS NULL
+WHERE ISNULL(ISNULL([e].[NullableIntA], [e].[NullableIntB]), [e].[IntC]) <> [e].[NullableIntC] OR [e].[NullableIntC] IS NULL
""");
}
@@ -4521,7 +4521,7 @@ public override async Task Coalesce_deeply_nested(bool async)
AssertSql(
"""
-SELECT COALESCE([e].[NullableIntA], [e].[NullableIntB], [e0].[NullableIntC], [e0].[NullableIntB], [e].[NullableIntC], [e0].[NullableIntA])
+SELECT ISNULL(ISNULL(ISNULL(ISNULL(ISNULL([e].[NullableIntA], [e].[NullableIntB]), [e0].[NullableIntC]), [e0].[NullableIntB]), [e].[NullableIntC]), [e0].[NullableIntA])
FROM [Entities1] AS [e]
INNER JOIN [Entities2] AS [e0] ON [e].[Id] = [e0].[Id]
""");
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs
index c70570a8c7d..f9f0a70c577 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs
@@ -547,7 +547,7 @@ public override async Task Projecting_owned_collection_and_aggregate(bool async)
AssertSql(
"""
SELECT [b].[Id], (
- SELECT COALESCE(SUM([p].[CommentsCount]), 0)
+ SELECT ISNULL(SUM([p].[CommentsCount]), 0)
FROM [Post] AS [p]
WHERE [b].[Id] = [p].[BlogId]), [p0].[Title], [p0].[CommentsCount], [p0].[BlogId], [p0].[Id]
FROM [Blog] AS [b]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs
index 6b28475aee8..fdd990baad5 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs
@@ -272,7 +272,7 @@ public override async Task Navigation_rewrite_on_owned_collection_with_compositi
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) CASE
WHEN [o0].[Id] <> 42 THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
@@ -1325,7 +1325,7 @@ FROM [OwnedPerson] AS [o2]
LEFT JOIN [Planet] AS [p] ON [o1].[PersonAddress_Country_PlanetId] = [p].[Id]
LEFT JOIN [Star] AS [s] ON [p].[StarId] = [s].[Id]
WHERE [o0].[Key] = [o1].[Key]) AS [p1], (
- SELECT COALESCE(SUM([s0].[Id]), 0)
+ SELECT ISNULL(SUM([s0].[Id]), 0)
FROM (
SELECT 1 AS [Key], [o4].[PersonAddress_Country_PlanetId]
FROM [OwnedPerson] AS [o4]
@@ -1505,7 +1505,7 @@ public override async Task GroupBy_aggregate_on_owned_navigation_in_aggregate_se
AssertSql(
"""
SELECT [o].[Id] AS [Key], (
- SELECT COALESCE(SUM([o0].[PersonAddress_Country_PlanetId]), 0)
+ SELECT ISNULL(SUM([o0].[PersonAddress_Country_PlanetId]), 0)
FROM [OwnedPerson] AS [o0]
WHERE [o].[Id] = [o0].[Id]) AS [Sum]
FROM [OwnedPerson] AS [o]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledQuerySqlServerTest.cs
index c56b17b6239..7dc1015cb78 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledQuerySqlServerTest.cs
@@ -1312,12 +1312,12 @@ public override async Task Terminating_Sum()
AssertSql(
"""
-SELECT COALESCE(SUM([b].[Id]), 0)
+SELECT ISNULL(SUM([b].[Id]), 0)
FROM [Blogs] AS [b]
""",
//
"""
-SELECT COALESCE(SUM([b].[Id]), 0)
+SELECT ISNULL(SUM([b].[Id]), 0)
FROM [Blogs] AS [b]
""");
}
@@ -1328,12 +1328,12 @@ public override async Task Terminating_SumAsync()
AssertSql(
"""
-SELECT COALESCE(SUM([b].[Id]), 0)
+SELECT ISNULL(SUM([b].[Id]), 0)
FROM [Blogs] AS [b]
""",
//
"""
-SELECT COALESCE(SUM([b].[Id]), 0)
+SELECT ISNULL(SUM([b].[Id]), 0)
FROM [Blogs] AS [b]
""");
}
@@ -1381,7 +1381,7 @@ public override async Task Terminating_ExecuteUpdate()
@__suffix_0='Suffix' (Size = 4000)
UPDATE [b]
-SET [b].[Name] = COALESCE([b].[Name], N'') + @__suffix_0
+SET [b].[Name] = ISNULL([b].[Name], N'') + @__suffix_0
FROM [Blogs] AS [b]
WHERE [b].[Id] > 8
""",
@@ -1402,7 +1402,7 @@ public override async Task Terminating_ExecuteUpdateAsync()
@__suffix_0='Suffix' (Size = 4000)
UPDATE [b]
-SET [b].[Name] = COALESCE([b].[Name], N'') + @__suffix_0
+SET [b].[Name] = ISNULL([b].[Name], N'') + @__suffix_0
FROM [Blogs] AS [b]
WHERE [b].[Id] > 8
""",
@@ -1575,7 +1575,7 @@ await Test(
AssertSql(
"""
-SELECT COALESCE(STRING_AGG(COALESCE([b].[Name], N''), N', ') WITHIN GROUP (ORDER BY [b].[Name]), N'')
+SELECT ISNULL(STRING_AGG(ISNULL([b].[Name], N''), N', ') WITHIN GROUP (ORDER BY [b].[Name]), N'')
FROM [Blogs] AS [b]
GROUP BY [b].[Id]
""");
@@ -1844,7 +1844,7 @@ public override async Task Project_anonymous_object()
AssertSql(
"""
-SELECT COALESCE([b].[Name], N'') + N'Foo' AS [Foo]
+SELECT ISNULL([b].[Name], N'') + N'Foo' AS [Foo]
FROM [Blogs] AS [b]
""");
}
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs
index 37725332129..4a3486abede 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/PrimitiveCollectionsQuerySqlServerTest.cs
@@ -1033,7 +1033,7 @@ public override async Task Column_collection_FirstOrDefault(bool async)
"""
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
FROM [PrimitiveCollectionsEntity] AS [p]
-WHERE COALESCE((
+WHERE ISNULL((
SELECT TOP(1) CAST([i].[value] AS int) AS [value]
FROM OPENJSON([p].[Ints]) AS [i]
ORDER BY CAST([i].[key] AS int)), 0) = 1
@@ -1063,7 +1063,7 @@ public override async Task Column_collection_SingleOrDefault(bool async)
"""
SELECT [p].[Id], [p].[Bool], [p].[Bools], [p].[DateTime], [p].[DateTimes], [p].[Enum], [p].[Enums], [p].[Int], [p].[Ints], [p].[NullableInt], [p].[NullableInts], [p].[NullableString], [p].[NullableStrings], [p].[String], [p].[Strings]
FROM [PrimitiveCollectionsEntity] AS [p]
-WHERE COALESCE((
+WHERE ISNULL((
SELECT TOP(1) CAST([i].[value] AS int) AS [value]
FROM OPENJSON([p].[Ints]) AS [i]
ORDER BY CAST([i].[key] AS int)), 0) = 1
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs
index 533c570af09..5bee7a3c3d9 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs
@@ -845,7 +845,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o]
) AS [u]
-WHERE [u].[Rank] & COALESCE((
+WHERE [u].[Rank] & ISNULL((
SELECT TOP(1) [u0].[Rank]
FROM (
SELECT [g0].[Nickname], [g0].[SquadId], [g0].[Rank]
@@ -854,7 +854,7 @@ UNION ALL
SELECT [o0].[Nickname], [o0].[SquadId], [o0].[Rank]
FROM [Officers] AS [o0]
) AS [u0]
- ORDER BY [u0].[Nickname], [u0].[SquadId]), 0) = COALESCE((
+ ORDER BY [u0].[Nickname], [u0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [u0].[Rank]
FROM (
SELECT [g0].[Nickname], [g0].[SquadId], [g0].[Rank]
@@ -875,7 +875,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o]
) AS [u]
-WHERE 2 & COALESCE((
+WHERE 2 & ISNULL((
SELECT TOP(1) [u0].[Rank]
FROM (
SELECT [g0].[Nickname], [g0].[SquadId], [g0].[Rank]
@@ -884,7 +884,7 @@ UNION ALL
SELECT [o0].[Nickname], [o0].[SquadId], [o0].[Rank]
FROM [Officers] AS [o0]
) AS [u0]
- ORDER BY [u0].[Nickname], [u0].[SquadId]), 0) = COALESCE((
+ ORDER BY [u0].[Nickname], [u0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [u0].[Rank]
FROM (
SELECT [g0].[Nickname], [g0].[SquadId], [g0].[Rank]
@@ -1474,7 +1474,7 @@ public override async Task Select_null_propagation_optimization8(bool async)
AssertSql(
"""
-SELECT COALESCE([u].[LeaderNickname], N'') + COALESCE([u].[LeaderNickname], N'')
+SELECT ISNULL([u].[LeaderNickname], N'') + ISNULL([u].[LeaderNickname], N'')
FROM (
SELECT [g].[Nickname], [g].[SquadId], [g].[LeaderNickname]
FROM [Gears] AS [g]
@@ -2095,7 +2095,7 @@ public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool as
AssertSql(
"""
-SELECT TOP(1) COALESCE([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
+SELECT TOP(1) ISNULL([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
ORDER BY [w].[Id]
@@ -2116,7 +2116,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o]
) AS [u]
-WHERE COALESCE((
+WHERE ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName]
@@ -2160,7 +2160,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o]
) AS [u]
-WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -2236,7 +2236,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o]
) AS [u]
-WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -2261,7 +2261,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o]
) AS [u]
-WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit)) = CAST(1 AS bit)
@@ -2360,7 +2360,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o]
) AS [u]
-WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -2997,7 +2997,7 @@ public override async Task Unicode_string_literals_is_used_for_non_unicode_colum
"""
SELECT [c].[Name], [c].[Location], [c].[Nation]
FROM [Cities] AS [c]
-WHERE COALESCE([c].[Location], N'') + N'Added' LIKE N'%Add%'
+WHERE ISNULL([c].[Location], N'') + N'Added' LIKE N'%Add%'
""");
}
@@ -3218,7 +3218,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch]
FROM [Officers] AS [o]
) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId]
-WHERE COALESCE([u].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ISNULL([u].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -3237,7 +3237,7 @@ UNION ALL
SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch]
FROM [Officers] AS [o]
) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId]
-WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([u].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([u].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -3248,7 +3248,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions
AssertSql(
"""
SELECT CASE
- WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([u].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
+ WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([u].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END
FROM [Tags] AS [t]
@@ -4064,7 +4064,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo
AssertSql(
"""
-SELECT COALESCE(SUM([u].[SquadId]), 0)
+SELECT ISNULL(SUM([u].[SquadId]), 0)
FROM (
SELECT [g].[Nickname], [g].[SquadId]
FROM [Gears] AS [g]
@@ -5442,11 +5442,11 @@ public override async Task ToString_nullable_enum_property_projection(bool async
await base.ToString_nullable_enum_property_projection(async);
AssertSql(
-"""
+ """
SELECT CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END
FROM [Weapons] AS [w]
""");
@@ -5469,13 +5469,13 @@ public override async Task ToString_nullable_enum_contains(bool async)
await base.ToString_nullable_enum_contains(async);
AssertSql(
-"""
+ """
SELECT [w].[Name]
FROM [Weapons] AS [w]
WHERE CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END LIKE N'%Cart%'
""");
}
@@ -7059,7 +7059,7 @@ public override async Task Negated_bool_ternary_inside_anonymous_type_in_project
"""
SELECT CASE
WHEN [u].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit)
- ELSE COALESCE([u].[HasSoulPatch], CAST(1 AS bit))
+ ELSE ISNULL([u].[HasSoulPatch], CAST(1 AS bit))
END ^ CAST(1 AS bit) AS [c]
FROM [Tags] AS [t]
LEFT JOIN (
@@ -7347,7 +7347,7 @@ public override async Task Project_one_value_type_from_empty_collection(bool asy
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) [u].[SquadId]
FROM (
SELECT [g].[SquadId], [g].[HasSoulPatch]
@@ -7418,7 +7418,7 @@ public override async Task Filter_on_subquery_projecting_one_value_type_from_emp
"""
SELECT [s].[Name]
FROM [Squads] AS [s]
-WHERE [s].[Name] = N'Kilo' AND COALESCE((
+WHERE [s].[Name] = N'Kilo' AND ISNULL((
SELECT TOP(1) [u].[SquadId]
FROM (
SELECT [g].[SquadId], [g].[HasSoulPatch]
@@ -7437,7 +7437,7 @@ public override async Task Select_subquery_projecting_single_constant_int(bool a
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) 42
FROM (
SELECT [g].[SquadId], [g].[HasSoulPatch]
@@ -7477,7 +7477,7 @@ public override async Task Select_subquery_projecting_single_constant_bool(bool
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) CAST(1 AS bit)
FROM (
SELECT [g].[SquadId], [g].[HasSoulPatch]
@@ -7702,7 +7702,7 @@ UNION ALL
SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator]
FROM [Officers] AS [o0]
) AS [u0] ON [u].[Nickname] = [u0].[LeaderNickname] AND [u].[SquadId] = [u0].[LeaderSquadId]
-ORDER BY COALESCE((
+ORDER BY ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName]
@@ -7764,7 +7764,7 @@ FROM [Officers] AS [o1]
ORDER BY (
SELECT COUNT(*)
FROM [Weapons] AS [w]
- WHERE [u].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = COALESCE((
+ WHERE [u].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = ISNULL((
SELECT TOP(1) [u0].[HasSoulPatch]
FROM (
SELECT [g].[Nickname], [g].[HasSoulPatch]
@@ -7794,7 +7794,7 @@ public override async Task Select_subquery_boolean(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName]
@@ -7836,7 +7836,7 @@ public override async Task Select_subquery_int_with_inside_cast_and_coalesce(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName]
@@ -7857,7 +7857,7 @@ public override async Task Select_subquery_int_with_outside_cast_and_coalesce(bo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName]
@@ -7878,7 +7878,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce(bool a
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName]
@@ -7899,7 +7899,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce2(bool
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName]
@@ -7924,7 +7924,7 @@ public override async Task Select_subquery_boolean_empty(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'
@@ -7966,7 +7966,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean1(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -7990,7 +7990,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit))
@@ -8035,7 +8035,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -8059,7 +8059,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [u].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'), CAST(0 AS bit))
@@ -8278,7 +8278,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + CAST(5 AS nvarchar(max))
+ORDER BY ISNULL([w0].[Name], N'') + CAST(5 AS nvarchar(max))
""");
}
@@ -8291,7 +8291,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + N'Marcus'' Lancer'
+ORDER BY ISNULL([w0].[Name], N'') + N'Marcus'' Lancer'
""");
}
@@ -8301,7 +8301,7 @@ public override async Task String_concat_on_various_types(bool async)
AssertSql(
"""
-SELECT N'HasSoulPatch ' + CAST([u].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([u].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([u].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
+SELECT N'HasSoulPatch ' + CAST([u].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([u].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([u].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + ISNULL(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
FROM (
SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch], [g].[Rank]
FROM [Gears] AS [g]
@@ -8349,7 +8349,7 @@ public override async Task GroupBy_Property_Include_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([u].[SquadId]), 0)
+SELECT ISNULL(SUM([u].[SquadId]), 0)
FROM (
SELECT [g].[SquadId], [g].[Rank]
FROM [Gears] AS [g]
@@ -8642,7 +8642,7 @@ public override async Task GetValueOrDefault_in_projection(bool async)
AssertSql(
"""
-SELECT COALESCE([w].[SynergyWithId], 0)
+SELECT ISNULL([w].[SynergyWithId], 0)
FROM [Weapons] AS [w]
""");
}
@@ -8655,7 +8655,7 @@ public override async Task GetValueOrDefault_in_filter(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], 0) = 0
+WHERE ISNULL([w].[SynergyWithId], 0) = 0
""");
}
@@ -8679,7 +8679,7 @@ public override async Task GetValueOrDefault_in_order_by(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-ORDER BY COALESCE([w].[SynergyWithId], 0), [w].[Id]
+ORDER BY ISNULL([w].[SynergyWithId], 0), [w].[Id]
""");
}
@@ -8691,7 +8691,7 @@ public override async Task GetValueOrDefault_with_argument(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], [w].[Id]) = 1
+WHERE ISNULL([w].[SynergyWithId], [w].[Id]) = 1
""");
}
@@ -8703,7 +8703,7 @@ public override async Task GetValueOrDefault_with_argument_complex(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
+WHERE ISNULL([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
""");
}
@@ -9634,7 +9634,7 @@ public override async Task Complex_GroupBy_after_set_operator(bool async)
AssertSql(
"""
-SELECT [u1].[Name], [u1].[Count], COALESCE(SUM([u1].[Count]), 0) AS [Sum]
+SELECT [u1].[Name], [u1].[Count], ISNULL(SUM([u1].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -9672,7 +9672,7 @@ public override async Task Complex_GroupBy_after_set_operator_using_result_selec
AssertSql(
"""
-SELECT [u1].[Name], [u1].[Count], COALESCE(SUM([u1].[Count]), 0) AS [Sum]
+SELECT [u1].[Name], [u1].[Count], ISNULL(SUM([u1].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -10974,7 +10974,7 @@ public override async Task Coalesce_used_with_non_unicode_string_column_and_cons
AssertSql(
"""
-SELECT COALESCE([c].[Location], 'Unknown')
+SELECT ISNULL([c].[Location], 'Unknown')
FROM [Cities] AS [c]
""");
}
@@ -11169,7 +11169,7 @@ public override async Task FirstOrDefault_over_int_compared_to_zero(bool async)
"""
SELECT [s].[Name]
FROM [Squads] AS [s]
-WHERE [s].[Name] = N'Delta' AND COALESCE((
+WHERE [s].[Name] = N'Delta' AND ISNULL((
SELECT TOP(1) [u].[SquadId]
FROM (
SELECT [g].[SquadId], [g].[FullName], [g].[HasSoulPatch]
@@ -12426,7 +12426,7 @@ public override async Task FirstOrDefault_on_empty_collection_of_DateTime_in_sub
AssertSql(
"""
-SELECT [u].[Nickname], COALESCE((
+SELECT [u].[Nickname], ISNULL((
SELECT TOP(1) [t1].[IssueDate]
FROM [Tags] AS [t1]
WHERE [t1].[GearNickName] = [u].[FullName]
@@ -12439,7 +12439,7 @@ UNION ALL
FROM [Officers] AS [o]
) AS [u]
LEFT JOIN [Tags] AS [t] ON [u].[Nickname] = [t].[GearNickName] AND [u].[SquadId] = [t].[GearSquadId]
-WHERE [t].[IssueDate] > COALESCE((
+WHERE [t].[IssueDate] > ISNULL((
SELECT TOP(1) [t0].[IssueDate]
FROM [Tags] AS [t0]
WHERE [t0].[GearNickName] = [u].[FullName]
@@ -12481,7 +12481,7 @@ public override async Task Sum_with_no_data_nullable_double(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] AS [m]
WHERE [m].[CodeName] = N'Operation Foobar'
""");
@@ -12699,7 +12699,7 @@ public override async Task GroupBy_Select_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] AS [m]
GROUP BY [m].[CodeName]
""");
@@ -12798,7 +12798,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool
AssertSql(
"""
-SELECT [u].[FullName] + N'' + COALESCE([u].[LeaderNickname], N'') + N''
+SELECT [u].[FullName] + N'' + ISNULL([u].[LeaderNickname], N'') + N''
FROM (
SELECT [g].[FullName], [g].[LeaderNickname]
FROM [Gears] AS [g]
@@ -13499,7 +13499,7 @@ public override async Task Set_operator_with_navigation_in_projection_groupby_ag
AssertSql(
"""
SELECT [s].[Name], (
- SELECT COALESCE(SUM(CAST(LEN([c].[Location]) AS int)), 0)
+ SELECT ISNULL(SUM(CAST(LEN([c].[Location]) AS int)), 0)
FROM (
SELECT [g2].[SquadId], [g2].[CityOfBirthName]
FROM [Gears] AS [g2]
@@ -13625,7 +13625,7 @@ LEFT JOIN (
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row]
FROM [Weapons] AS [w]
) AS [w0]
- WHERE [w0].[row] <= COALESCE((
+ WHERE [w0].[row] <= ISNULL((
SELECT [n].[value]
FROM OPENJSON(@__numbers_0) WITH ([value] int '$') AS [n]
ORDER BY [n].[value]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs
index bec862b5e11..37363f9b647 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs
@@ -218,7 +218,7 @@ public override async Task Skip_navigation_select_many_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([s].[Key1]), 0)
+SELECT ISNULL(SUM([s].[Key1]), 0)
FROM (
SELECT [r].[Id]
FROM [Roots] AS [r]
@@ -292,7 +292,7 @@ public override async Task Skip_navigation_select_subquery_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([e1].[Id]), 0)
+ SELECT ISNULL(SUM([e1].[Id]), 0)
FROM [EntityOneEntityTwo] AS [e0]
INNER JOIN [EntityOnes] AS [e1] ON [e0].[OneSkipSharedId] = [e1].[Id]
WHERE [e].[Id] = [e0].[TwoSkipSharedId])
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs
index 408d87cb169..c65ce3845b2 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs
@@ -218,7 +218,7 @@ public override async Task Skip_navigation_select_many_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([s].[Key1]), 0)
+SELECT ISNULL(SUM([s].[Key1]), 0)
FROM (
SELECT [r].[Id]
FROM [Roots] AS [r]
@@ -292,7 +292,7 @@ public override async Task Skip_navigation_select_subquery_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([e1].[Id]), 0)
+ SELECT ISNULL(SUM([e1].[Id]), 0)
FROM [EntityOneEntityTwo] AS [e0]
INNER JOIN [EntityOnes] AS [e1] ON [e0].[OneSkipSharedId] = [e1].[Id]
WHERE [e].[Id] = [e0].[TwoSkipSharedId])
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs
index e5eb5ca84f1..718d5dbf17f 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs
@@ -785,10 +785,10 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer'
END AS [Discriminator]
FROM [Gears] AS [g]
LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]
-WHERE [g].[Rank] & COALESCE((
+WHERE [g].[Rank] & ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
- ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE((
+ ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)
@@ -800,10 +800,10 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer'
END AS [Discriminator]
FROM [Gears] AS [g]
LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]
-WHERE 2 & COALESCE((
+WHERE 2 & ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
- ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE((
+ ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] AS [g0]
ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)
@@ -1283,7 +1283,7 @@ public override async Task Select_null_propagation_optimization8(bool async)
AssertSql(
"""
-SELECT COALESCE([g].[LeaderNickname], N'') + COALESCE([g].[LeaderNickname], N'')
+SELECT ISNULL([g].[LeaderNickname], N'') + ISNULL([g].[LeaderNickname], N'')
FROM [Gears] AS [g]
""");
}
@@ -1745,7 +1745,7 @@ public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool as
AssertSql(
"""
-SELECT TOP(1) COALESCE([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
+SELECT TOP(1) ISNULL([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
ORDER BY [w].[Id]
@@ -1763,7 +1763,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer'
END AS [Discriminator]
FROM [Gears] AS [g]
LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]
-WHERE COALESCE((
+WHERE ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -1801,7 +1801,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer'
END AS [Discriminator]
FROM [Gears] AS [g]
LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -1868,7 +1868,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer'
END AS [Discriminator]
FROM [Gears] AS [g]
LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -1890,7 +1890,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer'
END AS [Discriminator]
FROM [Gears] AS [g]
LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit)) = CAST(1 AS bit)
@@ -1977,7 +1977,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer'
END AS [Discriminator]
FROM [Gears] AS [g]
LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -2510,7 +2510,7 @@ public override async Task Unicode_string_literals_is_used_for_non_unicode_colum
"""
SELECT [c].[Name], [c].[Location], [c].[Nation]
FROM [Cities] AS [c]
-WHERE COALESCE([c].[Location], N'') + N'Added' LIKE N'%Add%'
+WHERE ISNULL([c].[Location], N'') + N'Added' LIKE N'%Add%'
""");
}
@@ -2711,7 +2711,7 @@ LEFT JOIN (
SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch]
FROM [Gears] AS [g]
) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId]
-WHERE COALESCE([s].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ISNULL([s].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -2727,7 +2727,7 @@ LEFT JOIN (
SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch]
FROM [Gears] AS [g]
) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId]
-WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([s].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([s].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -2738,7 +2738,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions
AssertSql(
"""
SELECT CASE
- WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([s].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
+ WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([s].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END
FROM [Tags] AS [t]
@@ -3460,7 +3460,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo
AssertSql(
"""
-SELECT COALESCE(SUM([g].[SquadId]), 0)
+SELECT ISNULL(SUM([g].[SquadId]), 0)
FROM [Gears] AS [g]
LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId]
WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL
@@ -4714,11 +4714,11 @@ public override async Task ToString_nullable_enum_property_projection(bool async
await base.ToString_nullable_enum_property_projection(async);
AssertSql(
-"""
+ """
SELECT CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END
FROM [Weapons] AS [w]
""");
@@ -4741,13 +4741,13 @@ public override async Task ToString_nullable_enum_contains(bool async)
await base.ToString_nullable_enum_contains(async);
AssertSql(
-"""
+ """
SELECT [w].[Name]
FROM [Weapons] AS [w]
WHERE CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END LIKE N'%Cart%'
""");
}
@@ -5969,7 +5969,7 @@ public override async Task Negated_bool_ternary_inside_anonymous_type_in_project
"""
SELECT CASE
WHEN [s].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit)
- ELSE COALESCE([s].[HasSoulPatch], CAST(1 AS bit))
+ ELSE ISNULL([s].[HasSoulPatch], CAST(1 AS bit))
END ^ CAST(1 AS bit) AS [c]
FROM [Tags] AS [t]
LEFT JOIN (
@@ -6201,7 +6201,7 @@ public override async Task Project_one_value_type_from_empty_collection(bool asy
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [SquadId]
@@ -6254,7 +6254,7 @@ public override async Task Filter_on_subquery_projecting_one_value_type_from_emp
"""
SELECT [s].[Name]
FROM [Squads] AS [s]
-WHERE [s].[Name] = N'Kilo' AND COALESCE((
+WHERE [s].[Name] = N'Kilo' AND ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) <> 0
@@ -6267,7 +6267,7 @@ public override async Task Select_subquery_projecting_single_constant_int(bool a
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) 42
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [Gear]
@@ -6295,7 +6295,7 @@ public override async Task Select_subquery_projecting_single_constant_bool(bool
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) CAST(1 AS bit)
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), CAST(0 AS bit)) AS [Gear]
@@ -6487,7 +6487,7 @@ FROM [Gears] AS [g0]
LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId]
) AS [s] ON [g].[Nickname] = [s].[LeaderNickname] AND [g].[SquadId] = [s].[LeaderSquadId]
WHERE [o].[Nickname] IS NOT NULL
-ORDER BY COALESCE((
+ORDER BY ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -6541,7 +6541,7 @@ WHERE [o].[Nickname] IS NOT NULL
ORDER BY (
SELECT COUNT(*)
FROM [Weapons] AS [w]
- WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = COALESCE((
+ WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = ISNULL((
SELECT TOP(1) [g0].[HasSoulPatch]
FROM [Gears] AS [g0]
WHERE [g0].[Nickname] = N'Marcus'), CAST(0 AS bit))), [g].[Nickname], [g].[SquadId], [s].[Nickname]
@@ -6569,7 +6569,7 @@ public override async Task Select_subquery_boolean(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -6599,7 +6599,7 @@ public override async Task Select_subquery_int_with_inside_cast_and_coalesce(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -6614,7 +6614,7 @@ public override async Task Select_subquery_int_with_outside_cast_and_coalesce(bo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -6629,7 +6629,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce(bool a
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -6644,7 +6644,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce2(bool
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -6663,7 +6663,7 @@ public override async Task Select_subquery_boolean_empty(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'
@@ -6693,7 +6693,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean1(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -6711,7 +6711,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit))
@@ -6744,7 +6744,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
@@ -6762,7 +6762,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'), CAST(0 AS bit))
@@ -6957,7 +6957,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + CAST(5 AS nvarchar(max))
+ORDER BY ISNULL([w0].[Name], N'') + CAST(5 AS nvarchar(max))
""");
}
@@ -6970,7 +6970,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId]
FROM [Weapons] AS [w]
LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + N'Marcus'' Lancer'
+ORDER BY ISNULL([w0].[Name], N'') + N'Marcus'' Lancer'
""");
}
@@ -6980,7 +6980,7 @@ public override async Task String_concat_on_various_types(bool async)
AssertSql(
"""
-SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
+SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + ISNULL(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
FROM [Gears] AS [g]
CROSS JOIN [Missions] AS [m]
ORDER BY [g].[Nickname], [m].[Id]
@@ -7016,7 +7016,7 @@ public override async Task GroupBy_Property_Include_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([g].[SquadId]), 0)
+SELECT ISNULL(SUM([g].[SquadId]), 0)
FROM [Gears] AS [g]
GROUP BY [g].[Rank]
""");
@@ -7241,7 +7241,7 @@ public override async Task GetValueOrDefault_in_projection(bool async)
AssertSql(
"""
-SELECT COALESCE([w].[SynergyWithId], 0)
+SELECT ISNULL([w].[SynergyWithId], 0)
FROM [Weapons] AS [w]
""");
}
@@ -7254,7 +7254,7 @@ public override async Task GetValueOrDefault_in_filter(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], 0) = 0
+WHERE ISNULL([w].[SynergyWithId], 0) = 0
""");
}
@@ -7278,7 +7278,7 @@ public override async Task GetValueOrDefault_in_order_by(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-ORDER BY COALESCE([w].[SynergyWithId], 0), [w].[Id]
+ORDER BY ISNULL([w].[SynergyWithId], 0), [w].[Id]
""");
}
@@ -7290,7 +7290,7 @@ public override async Task GetValueOrDefault_with_argument(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], [w].[Id]) = 1
+WHERE ISNULL([w].[SynergyWithId], [w].[Id]) = 1
""");
}
@@ -7302,7 +7302,7 @@ public override async Task GetValueOrDefault_with_argument_complex(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId]
FROM [Weapons] AS [w]
-WHERE COALESCE([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
+WHERE ISNULL([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
""");
}
@@ -8228,7 +8228,7 @@ public override async Task Complex_GroupBy_after_set_operator(bool async)
AssertSql(
"""
-SELECT [u].[Name], [u].[Count], COALESCE(SUM([u].[Count]), 0) AS [Sum]
+SELECT [u].[Name], [u].[Count], ISNULL(SUM([u].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -8254,7 +8254,7 @@ public override async Task Complex_GroupBy_after_set_operator_using_result_selec
AssertSql(
"""
-SELECT [u].[Name], [u].[Count], COALESCE(SUM([u].[Count]), 0) AS [Sum]
+SELECT [u].[Name], [u].[Count], ISNULL(SUM([u].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -9314,7 +9314,7 @@ public override async Task Coalesce_used_with_non_unicode_string_column_and_cons
AssertSql(
"""
-SELECT COALESCE([c].[Location], 'Unknown')
+SELECT ISNULL([c].[Location], 'Unknown')
FROM [Cities] AS [c]
""");
}
@@ -9470,7 +9470,7 @@ public override async Task FirstOrDefault_over_int_compared_to_zero(bool async)
"""
SELECT [s].[Name]
FROM [Squads] AS [s]
-WHERE [s].[Name] = N'Delta' AND COALESCE((
+WHERE [s].[Name] = N'Delta' AND ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)
@@ -10595,14 +10595,14 @@ public override async Task FirstOrDefault_on_empty_collection_of_DateTime_in_sub
AssertSql(
"""
-SELECT [g].[Nickname], COALESCE((
+SELECT [g].[Nickname], ISNULL((
SELECT TOP(1) [t1].[IssueDate]
FROM [Tags] AS [t1]
WHERE [t1].[GearNickName] = [g].[FullName]
ORDER BY [t1].[Id]), '0001-01-01T00:00:00.0000000') AS [invalidTagIssueDate]
FROM [Gears] AS [g]
LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId]
-WHERE [t].[IssueDate] > COALESCE((
+WHERE [t].[IssueDate] > ISNULL((
SELECT TOP(1) [t0].[IssueDate]
FROM [Tags] AS [t0]
WHERE [t0].[GearNickName] = [g].[FullName]
@@ -10663,7 +10663,7 @@ public override async Task Sum_with_no_data_nullable_double(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] AS [m]
WHERE [m].[CodeName] = N'Operation Foobar'
""");
@@ -10856,7 +10856,7 @@ public override async Task GroupBy_Select_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] AS [m]
GROUP BY [m].[CodeName]
""");
@@ -10954,7 +10954,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool
AssertSql(
"""
-SELECT [g].[FullName] + N'' + COALESCE([g].[LeaderNickname], N'') + N''
+SELECT [g].[FullName] + N'' + ISNULL([g].[LeaderNickname], N'') + N''
FROM [Gears] AS [g]
""");
}
@@ -11556,7 +11556,7 @@ public override async Task Set_operator_with_navigation_in_projection_groupby_ag
AssertSql(
"""
SELECT [s].[Name], (
- SELECT COALESCE(SUM(CAST(LEN([c].[Location]) AS int)), 0)
+ SELECT ISNULL(SUM(CAST(LEN([c].[Location]) AS int)), 0)
FROM [Gears] AS [g2]
INNER JOIN [Squads] AS [s0] ON [g2].[SquadId] = [s0].[Id]
INNER JOIN [Cities] AS [c] ON [g2].[CityOfBirthName] = [c].[Name]
@@ -11646,7 +11646,7 @@ LEFT JOIN (
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row]
FROM [Weapons] AS [w]
) AS [w0]
- WHERE [w0].[row] <= COALESCE((
+ WHERE [w0].[row] <= ISNULL((
SELECT [n].[value]
FROM OPENJSON(@__numbers_0) WITH ([value] int '$') AS [n]
ORDER BY [n].[value]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs
index fb3de51adc9..a9eaf8b7b13 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs
@@ -208,7 +208,7 @@ public override async Task Skip_navigation_select_many_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([s].[Key1]), 0)
+SELECT ISNULL(SUM([s].[Key1]), 0)
FROM [Roots] AS [r]
INNER JOIN (
SELECT [e0].[Key1], [e].[RootSkipSharedId]
@@ -272,7 +272,7 @@ public override async Task Skip_navigation_select_subquery_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([e1].[Id]), 0)
+ SELECT ISNULL(SUM([e1].[Id]), 0)
FROM [EntityOneEntityTwo] AS [e0]
INNER JOIN [EntityOnes] AS [e1] ON [e0].[OneSkipSharedId] = [e1].[Id]
WHERE [e].[Id] = [e0].[TwoSkipSharedId])
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs
index f968dce9aeb..f89c8180f7a 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs
@@ -207,7 +207,7 @@ public override async Task Skip_navigation_select_many_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([s].[Key1]), 0)
+SELECT ISNULL(SUM([s].[Key1]), 0)
FROM [Roots] AS [r]
INNER JOIN (
SELECT [e0].[Key1], [e].[RootSkipSharedId]
@@ -271,7 +271,7 @@ public override async Task Skip_navigation_select_subquery_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([e1].[Id]), 0)
+ SELECT ISNULL(SUM([e1].[Id]), 0)
FROM [EntityOneEntityTwo] AS [e0]
INNER JOIN [EntityOnes] AS [e1] ON [e0].[OneSkipSharedId] = [e1].[Id]
WHERE [e].[Id] = [e0].[TwoSkipSharedId])
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs
index 3f18a794b31..c2cf0ba87c6 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs
@@ -771,7 +771,7 @@ public override async Task String_concat_with_null_conditional_argument(bool asy
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + CAST(5 AS nvarchar(max))
+ORDER BY ISNULL([w0].[Name], N'') + CAST(5 AS nvarchar(max))
""");
}
@@ -847,7 +847,7 @@ public override async Task Select_subquery_int_with_outside_cast_and_coalesce(bo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -1510,7 +1510,7 @@ public override async Task String_concat_with_null_conditional_argument2(bool as
SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
-ORDER BY COALESCE([w0].[Name], N'') + N'Marcus'' Lancer'
+ORDER BY ISNULL([w0].[Name], N'') + N'Marcus'' Lancer'
""");
}
@@ -1549,7 +1549,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit))
@@ -1822,7 +1822,7 @@ public override async Task Project_one_value_type_from_empty_collection(bool asy
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [SquadId]
@@ -2062,7 +2062,7 @@ public override async Task Where_subquery_boolean(bool async)
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
-WHERE COALESCE((
+WHERE ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -2396,7 +2396,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce(bool a
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -2411,7 +2411,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'), CAST(0 AS bit))
@@ -2889,7 +2889,7 @@ public override async Task GetValueOrDefault_in_order_by(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
-ORDER BY COALESCE([w].[SynergyWithId], 0), [w].[Id]
+ORDER BY ISNULL([w].[SynergyWithId], 0), [w].[Id]
""");
}
@@ -2899,7 +2899,7 @@ public override async Task GroupBy_Property_Include_Select_Sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([g].[SquadId]), 0)
+SELECT ISNULL(SUM([g].[SquadId]), 0)
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
GROUP BY [g].[Rank]
""");
@@ -3332,7 +3332,7 @@ public override async Task GetValueOrDefault_in_projection(bool async)
AssertSql(
"""
-SELECT COALESCE([w].[SynergyWithId], 0)
+SELECT ISNULL([w].[SynergyWithId], 0)
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
""");
}
@@ -3431,7 +3431,7 @@ public override async Task Include_collection_with_complex_OrderBy3(bool async)
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]
WHERE [g].[Discriminator] = N'Officer'
-ORDER BY COALESCE((
+ORDER BY ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -3769,7 +3769,7 @@ public override async Task GetValueOrDefault_with_argument_complex(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
-WHERE COALESCE([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
+WHERE ISNULL([w].[SynergyWithId], CAST(LEN([w].[Name]) AS int) + 42) > 10
""");
}
@@ -3861,7 +3861,7 @@ public override async Task Filter_on_subquery_projecting_one_value_type_from_emp
"""
SELECT [s].[Name]
FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s]
-WHERE [s].[Name] = N'Kilo' AND COALESCE((
+WHERE [s].[Name] = N'Kilo' AND ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) <> 0
@@ -3912,7 +3912,7 @@ public override async Task GroupBy_Select_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m]
GROUP BY [m].[CodeName]
""");
@@ -3949,7 +3949,7 @@ public override async Task Select_subquery_boolean_empty(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'
@@ -4116,7 +4116,7 @@ public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool as
AssertSql(
"""
-SELECT TOP(1) COALESCE([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
+SELECT TOP(1) ISNULL([w0].[IsAutomatic], CAST(0 AS bit)) AS [IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [w].[SynergyWithId] = [w0].[Id]
ORDER BY [w].[Id]
@@ -4224,7 +4224,7 @@ public override async Task Select_subquery_int_with_inside_cast_and_coalesce(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -4422,7 +4422,7 @@ public override async Task Negated_bool_ternary_inside_anonymous_type_in_project
"""
SELECT CASE
WHEN [g].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit)
- ELSE COALESCE([g].[HasSoulPatch], CAST(1 AS bit))
+ ELSE ISNULL([g].[HasSoulPatch], CAST(1 AS bit))
END ^ CAST(1 AS bit) AS [c]
FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t]
LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]
@@ -4710,7 +4710,7 @@ public override async Task Where_subquery_distinct_firstordefault_boolean(bool a
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
@@ -4825,11 +4825,11 @@ public override async Task ToString_nullable_enum_property_projection(bool async
await base.ToString_nullable_enum_property_projection(async);
AssertSql(
-"""
+ """
SELECT CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
""");
@@ -4852,13 +4852,13 @@ public override async Task ToString_nullable_enum_contains(bool async)
await base.ToString_nullable_enum_contains(async);
AssertSql(
-"""
+ """
SELECT [w].[Name]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE CASE [w].[AmmunitionType]
WHEN 1 THEN N'Cartridge'
WHEN 2 THEN N'Shell'
- ELSE COALESCE(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
+ ELSE ISNULL(CAST([w].[AmmunitionType] AS nvarchar(max)), N'')
END LIKE N'%Cart%'
""");
}
@@ -4897,7 +4897,7 @@ public override async Task Complex_GroupBy_after_set_operator(bool async)
AssertSql(
"""
-SELECT [u].[Name], [u].[Count], COALESCE(SUM([u].[Count]), 0) AS [Sum]
+SELECT [u].[Name], [u].[Count], ISNULL(SUM([u].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -4945,10 +4945,10 @@ public override async Task Where_enum_has_flag_subquery(bool async)
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
-WHERE [g].[Rank] & COALESCE((
+WHERE [g].[Rank] & ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0]
- ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE((
+ ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0]
ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)
@@ -4957,10 +4957,10 @@ SELECT TOP(1) [g0].[Rank]
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
-WHERE 2 & COALESCE((
+WHERE 2 & ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0]
- ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE((
+ ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = ISNULL((
SELECT TOP(1) [g0].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0]
ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)
@@ -5001,7 +5001,7 @@ public override async Task Select_subquery_projecting_single_constant_bool(bool
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) CAST(1 AS bit)
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), CAST(0 AS bit)) AS [Gear]
@@ -5207,7 +5207,7 @@ public override async Task Coalesce_operator_in_predicate_with_other_conditions(
SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart]
FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t]
LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]
-WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -5442,7 +5442,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean1(boo
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
@@ -5723,7 +5723,7 @@ public override async Task Unicode_string_literals_is_used_for_non_unicode_colum
"""
SELECT [c].[Name], [c].[Location], [c].[Nation], [c].[PeriodEnd], [c].[PeriodStart]
FROM [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c]
-WHERE COALESCE([c].[Location], N'') + N'Added' LIKE N'%Add%'
+WHERE ISNULL([c].[Location], N'') + N'Added' LIKE N'%Add%'
""");
}
@@ -5751,7 +5751,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo
AssertSql(
"""
-SELECT COALESCE(SUM([g].[SquadId]), 0)
+SELECT ISNULL(SUM([g].[SquadId]), 0)
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId]
WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL
@@ -5981,7 +5981,7 @@ public override async Task GetValueOrDefault_in_filter(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
-WHERE COALESCE([w].[SynergyWithId], 0) = 0
+WHERE ISNULL([w].[SynergyWithId], 0) = 0
""");
}
@@ -6084,7 +6084,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean1(bool
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
@@ -6328,14 +6328,14 @@ public override async Task FirstOrDefault_on_empty_collection_of_DateTime_in_sub
AssertSql(
"""
-SELECT [g].[Nickname], COALESCE((
+SELECT [g].[Nickname], ISNULL((
SELECT TOP(1) [t1].[IssueDate]
FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t1]
WHERE [t1].[GearNickName] = [g].[FullName]
ORDER BY [t1].[Id]), '0001-01-01T00:00:00.0000000') AS [invalidTagIssueDate]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId]
-WHERE [t].[IssueDate] > COALESCE((
+WHERE [t].[IssueDate] > ISNULL((
SELECT TOP(1) [t0].[IssueDate]
FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0]
WHERE [t0].[GearNickName] = [g].[FullName]
@@ -6352,7 +6352,7 @@ public override async Task Coalesce_operator_in_predicate(bool async)
SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart]
FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t]
LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]
-WHERE COALESCE([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
+WHERE ISNULL([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit)
""");
}
@@ -6657,7 +6657,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT DISTINCT TOP(1) [w].[IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit)) = CAST(1 AS bit)
@@ -6755,7 +6755,7 @@ public override async Task Where_subquery_distinct_orderby_firstordefault_boolea
"""
SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
-WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE((
+WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
@@ -7159,7 +7159,7 @@ public override async Task Select_subquery_boolean(bool async)
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[IsAutomatic]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -7238,7 +7238,7 @@ public override async Task Select_subquery_int_with_pushdown_and_coalesce2(bool
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w].[Id]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
WHERE [g].[FullName] = [w].[OwnerFullName]
@@ -7576,7 +7576,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) [w0].[IsAutomatic]
FROM (
SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
@@ -8545,7 +8545,7 @@ public override async Task String_concat_on_various_types(bool async)
AssertSql(
"""
-SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
+SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + ISNULL(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
CROSS JOIN [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m]
ORDER BY [g].[Nickname], [m].[Id]
@@ -8602,7 +8602,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions
AssertSql(
"""
SELECT CASE
- WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND COALESCE([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
+ WHEN ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND ISNULL([g].[HasSoulPatch], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END
FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t]
@@ -8701,7 +8701,7 @@ public override async Task GetValueOrDefault_with_argument(bool async)
"""
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
-WHERE COALESCE([w].[SynergyWithId], [w].[Id]) = 1
+WHERE ISNULL([w].[SynergyWithId], [w].[Id]) = 1
""");
}
@@ -8944,7 +8944,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool
AssertSql(
"""
-SELECT [g].[FullName] + N'' + COALESCE([g].[LeaderNickname], N'') + N''
+SELECT [g].[FullName] + N'' + ISNULL([g].[LeaderNickname], N'') + N''
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
""");
}
@@ -8955,7 +8955,7 @@ public override async Task Coalesce_used_with_non_unicode_string_column_and_cons
AssertSql(
"""
-SELECT COALESCE([c].[Location], 'Unknown')
+SELECT ISNULL([c].[Location], 'Unknown')
FROM [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c]
""");
}
@@ -8966,7 +8966,7 @@ public override async Task Select_null_propagation_optimization8(bool async)
AssertSql(
"""
-SELECT COALESCE([g].[LeaderNickname], N'') + COALESCE([g].[LeaderNickname], N'')
+SELECT ISNULL([g].[LeaderNickname], N'') + ISNULL([g].[LeaderNickname], N'')
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
""");
}
@@ -9165,7 +9165,7 @@ public override async Task Sum_with_no_data_nullable_double(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([m].[Rating]), 0.0E0)
+SELECT ISNULL(SUM([m].[Rating]), 0.0E0)
FROM [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m]
WHERE [m].[CodeName] = N'Operation Foobar'
""");
@@ -9394,7 +9394,7 @@ LEFT JOIN (
ORDER BY (
SELECT COUNT(*)
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
- WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = COALESCE((
+ WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = ISNULL((
SELECT TOP(1) [g0].[HasSoulPatch]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0]
WHERE [g0].[Nickname] = N'Marcus'), CAST(0 AS bit))), [g].[Nickname], [g].[SquadId], [g2].[Nickname]
@@ -9530,7 +9530,7 @@ public override async Task Complex_GroupBy_after_set_operator_using_result_selec
AssertSql(
"""
-SELECT [u].[Name], [u].[Count], COALESCE(SUM([u].[Count]), 0) AS [Sum]
+SELECT [u].[Name], [u].[Count], ISNULL(SUM([u].[Count]), 0) AS [Sum]
FROM (
SELECT [c].[Name], (
SELECT COUNT(*)
@@ -9587,7 +9587,7 @@ public override async Task Select_subquery_projecting_single_constant_int(bool a
AssertSql(
"""
-SELECT [s].[Name], COALESCE((
+SELECT [s].[Name], ISNULL((
SELECT TOP(1) 42
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [Gear]
@@ -9603,7 +9603,7 @@ public override async Task FirstOrDefault_over_int_compared_to_zero(bool async)
"""
SELECT [s].[Name]
FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s]
-WHERE [s].[Name] = N'Delta' AND COALESCE((
+WHERE [s].[Name] = N'Delta' AND ISNULL((
SELECT TOP(1) [g].[SquadId]
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g]
WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)
@@ -10182,7 +10182,7 @@ public override async Task Set_operator_with_navigation_in_projection_groupby_ag
AssertSql(
"""
SELECT [s].[Name], (
- SELECT COALESCE(SUM(CAST(LEN([c].[Location]) AS int)), 0)
+ SELECT ISNULL(SUM(CAST(LEN([c].[Location]) AS int)), 0)
FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g2]
INNER JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s0] ON [g2].[SquadId] = [s0].[Id]
INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g2].[CityOfBirthName] = [c].[Name]
@@ -10266,7 +10266,7 @@ LEFT JOIN (
SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], ROW_NUMBER() OVER(PARTITION BY [w].[OwnerFullName] ORDER BY [w].[Id]) AS [row]
FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]
) AS [w0]
- WHERE [w0].[row] <= COALESCE((
+ WHERE [w0].[row] <= ISNULL((
SELECT [n].[value]
FROM OPENJSON(@__numbers_0) WITH ([value] int '$') AS [n]
ORDER BY [n].[value]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs
index a2d2ce977bc..08f1d13fec3 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs
@@ -234,7 +234,7 @@ public override async Task Skip_navigation_select_many_sum(bool async)
AssertSql(
"""
-SELECT COALESCE(SUM([s].[Key1]), 0)
+SELECT ISNULL(SUM([s].[Key1]), 0)
FROM [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e]
INNER JOIN (
SELECT [e1].[Key1], [e0].[RootSkipSharedId]
@@ -297,7 +297,7 @@ public override async Task Skip_navigation_select_subquery_sum(bool async)
AssertSql(
"""
SELECT (
- SELECT COALESCE(SUM([e1].[Id]), 0)
+ SELECT ISNULL(SUM([e1].[Id]), 0)
FROM [EntityOneEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0]
INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[OneSkipSharedId] = [e1].[Id]
WHERE [e].[Id] = [e0].[TwoSkipSharedId])
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs
index f1b85d890ab..948f95568fd 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs
@@ -289,7 +289,7 @@ public override async Task Navigation_rewrite_on_owned_collection_with_compositi
AssertSql(
"""
-SELECT COALESCE((
+SELECT ISNULL((
SELECT TOP(1) CASE
WHEN [o0].[Id] <> 42 THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
@@ -1303,7 +1303,7 @@ SELECT AVG(CAST([s].[Id] AS float))
LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p] ON [o1].[PersonAddress_Country_PlanetId] = [p].[Id]
LEFT JOIN [Star] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [p].[StarId] = [s].[Id]
WHERE [o0].[Key] = [o1].[Key]) AS [p1], (
- SELECT COALESCE(SUM([s0].[Id]), 0)
+ SELECT ISNULL(SUM([s0].[Id]), 0)
FROM (
SELECT 1 AS [Key], [o4].[PersonAddress_Country_PlanetId]
FROM [OwnedPerson] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o4]
@@ -1477,7 +1477,7 @@ public override async Task GroupBy_aggregate_on_owned_navigation_in_aggregate_se
AssertSql(
"""
SELECT [o].[Id] AS [Key], (
- SELECT COALESCE(SUM([o0].[PersonAddress_Country_PlanetId]), 0)
+ SELECT ISNULL(SUM([o0].[PersonAddress_Country_PlanetId]), 0)
FROM [OwnedPerson] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o0]
WHERE [o].[Id] = [o0].[Id]) AS [Sum]
FROM [OwnedPerson] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o]
diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs
index c4dcabf79ac..b29e6e793da 100644
--- a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs
+++ b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs
@@ -908,7 +908,7 @@ public override void TVF_with_navigation_in_projection_groupby_aggregate()
AssertSql(
"""
SELECT [c].[LastName], (
- SELECT COALESCE(SUM(CAST(LEN([c1].[FirstName]) AS int)), 0)
+ SELECT ISNULL(SUM(CAST(LEN([c1].[FirstName]) AS int)), 0)
FROM [Orders] AS [o0]
INNER JOIN [Customers] AS [c0] ON [o0].[CustomerId] = [c0].[Id]
INNER JOIN [Customers] AS [c1] ON [o0].[CustomerId] = [c1].[Id]
@@ -933,7 +933,7 @@ public override void TVF_with_argument_being_a_subquery_with_navigation_in_proje
AssertSql(
"""
SELECT [c0].[LastName], (
- SELECT COALESCE(SUM(CAST(LEN([c3].[FirstName]) AS int)), 0)
+ SELECT ISNULL(SUM(CAST(LEN([c3].[FirstName]) AS int)), 0)
FROM [Orders] AS [o0]
INNER JOIN [Customers] AS [c1] ON [o0].[CustomerId] = [c1].[Id]
INNER JOIN [Customers] AS [c3] ON [o0].[CustomerId] = [c3].[Id]