HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

how to solve this warning in select

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thissolvehowwarningselect

Problem

I have a problem with this query:

SELECT *
FROM Sales.SalesOrderDetail sod
JOIN Sales.SalesOrderHeader soh
ON sod.SalesOrderID = soh.SalesOrderID--- adventureworks db



Warnings


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 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.