snippetsqlMinor
how to solve this warning in select
Viewed 0 times
thissolvehowwarningselect
Problem
I have a problem with this query:
Warnings
Type conversion in expression
(CONVERT(nvarchar(23),[soh].[SalesOrderID],0)) may affect
"CardinalityEstimate" in query plan choice
SELECT *
FROM Sales.SalesOrderDetail sod
JOIN Sales.SalesOrderHeader soh
ON sod.SalesOrderID = soh.SalesOrderID--- adventureworks dbWarnings
Type conversion in expression
(CONVERT(nvarchar(23),[soh].[SalesOrderID],0)) may affect
"CardinalityEstimate" in query plan choice
Solution
There's nothing to fix, really.
The message refers to this computed column in the
The warning is informational in this case, to be sure you're aware in case it was a problem, as discussed in this Q&A: Type conversion in expression may affect “CardinalityEstimate” - on a computed column?
The message refers to this computed column in the
Sales.SalesOrderHeader table:[SalesOrderNumber] AS (isnull(N'SO'+CONVERT([nvarchar](23),[SalesOrderID]),N'*** ERROR ***')),The warning is informational in this case, to be sure you're aware in case it was a problem, as discussed in this Q&A: Type conversion in expression may affect “CardinalityEstimate” - on a computed column?
Code Snippets
[SalesOrderNumber] AS (isnull(N'SO'+CONVERT([nvarchar](23),[SalesOrderID]),N'*** ERROR ***')),Context
StackExchange Database Administrators Q#267478, answer score: 9
Revisions (0)
No revisions yet.