Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Contains Operator Expand / Collapse
Posted Saturday, December 28, 2013 4:26 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, December 28, 2013 4:14 AM
Points: 1, Visits: 19
I Write a query which use 'Contains' operator in it . when I execute this query in sql server 2005
the run time is very fast but when I execute in sql server 2008 R2 it took 16 seconds . I rebuild my
fulltext and alter all indexes in each table but did not work . Can anybody help me?
This is my query:
SELECT Distinct document.DocNo,document.DocType,Title.Title,Header.WriterName+' '+Header.WriterFamily+' '+Header.Conf+' '+Header.Tanalgan
AS Padid1 ,Publisher.PublisherName+' '+Publisher.PublishedPlace+' '+Publisher.PublishedDate
As T,Rade.MainRange+'،'+Rade.Num+'،'+Rade.KaterNo+'،'+Rade.Date1 As Rade
--,ROW_NUMBER() OVER(Order By Save1.SaveCode) AS RowNumber
FROM Document Left Outer JOIN
Description1 ON document.DocNo = Description1.DocNo Left Outer JOIN
Padid ON document.DocNo = Padid.DocNO Left Outer JOIN
Publisher ON document.DocNo = Publisher.DocNo Left Outer JOIN
rade ON document.DocNo = rade.DocNO Left Outer JOIN
Subjects ON document.DocNo = Subjects.DocNo Left Outer JOIN
Title ON document.DocNo = Title.DocNO Left Outer JOIN
Header ON document.DocNo = Header.DocNo,Save1
Where [Document].DocNo<>'0'
And [Document].DocNo=Save1.DocNo
And [Document].DocType=Save1.DocType

And document.DocType='Book'
AND (Save1.DocStatus = 'Shelf')
And( (CONTAINS(Title.Title , '"abc"')
OR CONTAINS( Header.WriterName , '"abc"')
OR CONTAINS( Header.WriterFamily , '"abc"')
OR CONTAINS(Publisher.PublisherName , '"abc"')
OR CONTAINS(Publisher.PublishedPlace , '"abc"')
OR CONTAINS(Publisher.PublishedDate , '"abc"')
OR CONTAINS(Description1.ISBN , '"abc"')
OR CONTAINS(Title.Farvast , '"abc"')
OR CONTAINS(Header.Tanalgan , '"abc"')
AND Rade.Type='LC'
Post #1526284
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse