0

So I have a temporary table with only one column NVARCHAR(400).

In this temp table, I Insert values from various sources.

One of these is

INSERT INTO @permissions
SELECT Concat (N'resourcetype_', CONVERT(NVARCHAR(36), resourcetypeid))
FROM   roleresourcetypepermission
WHERE  roleid = @roleId OR @IsAdmin = 1

I tried with + instead of CONCAT, tried not to convert them explicitly, nothing seems to be working. PlanWarnings

2
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Sep 13, 2021 at 12:12
  • Related: dba.stackexchange.com/questions/36097/…
    – Paul White
    Sep 13, 2021 at 12:57

1 Answer 1

2

Because they're two different data types, some type of conversion will always need to occur. You would need to persist the data already converted first to eliminate that warning.

That being said, this is in the SELECT part of your query and probably isn't actually causing any issues, therefore the warning can be disregarded. (If it was a type conversion in a predicate, that would be a different story.)

As mentioned by the community in the comments, it's unclear if you have any other issues other than the warning itself. If you're experiencing some sort of performance issues, then please update your question with more information and clarification, such as including the execution plan of the slow query itself.

2
  • No, only the plan itself. So is it a rule of thumb that I should get worried only if these warnings are in the WHERE clause? :) Sep 13, 2021 at 12:28
  • 1
    @CătălinRădoi Yea you shouldn't be too concerned about them unless your query is slow and the conversion is happening in your predicates (JOIN, WHERE, HAVING clauses). Then they may be one of your causes for slowness.
    – J.D.
    Sep 13, 2021 at 20:55

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .