﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Join on nvarchar column using LIKE / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 00:40:04 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Join on nvarchar column using LIKE</title><link>http://www.sqlservercentral.com/Forums/Topic1409840-392-1.aspx</link><description>[quote][b]praveen_vejandla (1/22/2013)[/b][hr]UPDATE LII   SET value_exists = 1  FROM LII od  JOIN VPL sl  ON (sl.it like '%' + od.value + '%'  AND od.opr = 9 )  WHERE od.tn = 'VPL'  AND od.cn = 'it'Is there anyway to rewrite above query for improved performance? I am joining two nvarchar columns (it, value) using LIKE and it seems very slow.Thanks.[/quote] send the index deifnition of Lil and VPL table</description><pubDate>Tue, 22 Jan 2013 01:05:05 GMT</pubDate><dc:creator>Bhuvnesh</dc:creator></item><item><title>RE: Join on nvarchar column using LIKE</title><link>http://www.sqlservercentral.com/Forums/Topic1409840-392-1.aspx</link><description>[code="sql"]UPDATE od	SET value_exists = 1 FROM LII od INNER JOIN VPL sl 	ON sl.it LIKE '%' + od.value + '%' WHERE od.tn = 'VPL' 	AND od.cn = 'it'	AND od.opr = 9 [/code]The LIKE operator used with a wildcard on the left hand side of the search expression makes the join non-SARGable (Google it), which results in a table scan of table VPL. Do you really need the leading %?</description><pubDate>Tue, 22 Jan 2013 00:59:19 GMT</pubDate><dc:creator>ChrisM@Work</dc:creator></item><item><title>Join on nvarchar column using LIKE</title><link>http://www.sqlservercentral.com/Forums/Topic1409840-392-1.aspx</link><description>UPDATE LII   SET value_exists = 1  FROM LII od  JOIN VPL sl  ON (sl.it like '%' + od.value + '%'  AND od.opr = 9 )  WHERE od.tn = 'VPL'  AND od.cn = 'it'Is there anyway to rewrite above query for improved performance? I am joining two nvarchar columns (it, value) using LIKE and it seems very slow.Thanks.</description><pubDate>Tue, 22 Jan 2013 00:49:55 GMT</pubDate><dc:creator>praveen_vejandla</dc:creator></item></channel></rss>