Execution plan -warnining with coverstion

Ashwan 531 Reputation points
2020-12-01T01:09:27.557+00:00

Hi My sql has an issue with execution plan warning SQL conversion when I use cast(VALUE1 as varchar(30)) or CONVERT(char,VALUE1). Both way I am getting the warning

table column is numaric (21,4)
43856-execution1.png

43864-execution2.png

any one can help would be highly appreciated .

many thanks

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,491 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Shashank Singh 6,251 Reputation points
    2020-12-01T07:00:53.45+00:00

    So you have done some conversion from some numeric datatype to Varchar(30). The warning is for that. In most cases I have seen this message benign and can be ignored. It is more of informative message. I cant read much though you have hidden lot of things.

    0 comments No comments

  2. Olaf Helper 46,201 Reputation points
    2020-12-01T07:19:17.583+00:00

    Have you used the conversion in the WHERE clause or JOIN condition? That prevents the usage of an existing index and that causes performance issues; that's why you get a warning.


  3. Ashwan 531 Reputation points
    2020-12-03T04:51:00.447+00:00

    Hi Ola Thank you for the responce. yes there is where clause and join . Thouse use to join/where clause with dffirent column .
    cmVALUE- is numaric
    cmVal1 - is character

    select T1.NO no, DESC name,
    case
    when convert(varchar(max),cmVALUE) = '' then convert(varchar(max),cmVALUE)
    when cmVALUE= 0 then convert(varchar(max),ATVALUE)
    else convert(varchar(max),cmVALUE)
    end cmVal1
    from echema.tab1
    where class = 'XV'
    and PNO is not null


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.