Sometimes the warning is nothing more than that, just a warning, and not something actually affecting performance.
The two things that are most likely affecting your performance are the Table Variable, and the fact you're looping instead of using a more relational solution. So I'd first run a SELECT * INTO #images FROM @images
to put it inside of a Temp Table before your WHILE
loop, and then use that Temp Table inside the loop instead, to potentially improve performance.
To answer your question though, I believe the fact that your imageid
is an INT but you're using it in a string function like CONCAT()
is where the Implicit Conversion is coming from that is inducing that Cardinality Estimate warning. If you stored a copy of it in your @images
table variable already casted as a string data type that was the same type as the extension
field and used it in the CONCAT()
function instead then the warning should go away.
Also, Table Variables typically result in poor Cardinality Estimates themselves because of their lack of statistics, which may be why the "Estimated Number of Rows Per Execution" is showing 1. (Note there's been improvements in SQL Server 2019.)