Skip to main content
2 of 5
added 36 characters in body
Mikael Eriksson
  • 22.2k
  • 5
  • 61
  • 104

Sql server changes execution plan

I have SQL code that is executing slowenter image description here

DECLARE @ccode varchar(500)
SET @ccode = '%NIP%'


SELECT  [CVN_UID]
  FROM [Klasje].[dbo].[VERSION_CATEGORY_XREFS]
 WHERE DESCRIPTOR_TEXT LIKE @ccode

Why sql server uses Nested loops?

This code is working fine, it uses only index scan:

SELECT  [CVN_UID]
  FROM [Klasje].[dbo].[VERSION_CATEGORY_XREFS]
 WHERE DESCRIPTOR_TEXT LIKE '%NIP%'
Matej
  • 107
  • 6