Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Vishal_sql
Posting Yak Master
102 Posts |
Posted - 2012-07-25 : 09:53:40
|
| If Full Text Catalog is created then Is it possible to use "CONTAINS" predicateas "NOT CONTAINS"We can do following using CONTAINS as below,SELECT EmpID,tasknameFROM EmployeeWHERE CONTAINS(taskname, 'billable expense AND billable expenses');I want to know is it possible to do SELECT EmpID,tasknameFROM EmployeeWHERE NOT CONTAINS(taskname, 'billable expense AND billable expenses');I havent tried either but want to know can we do Full text using NOT CONTAINS. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-25 : 10:10:26
|
there's no NOT CONTAINSbut you can achieve equivalent functionality as below i guessSELECT EmpID,tasknameFROM EmployeeEXCEPTSELECT EmpID,tasknameFROM EmployeeWHERE CONTAINS(taskname, 'billable expense AND billable expenses'); ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Vishal_sql
Posting Yak Master
102 Posts |
Posted - 2012-07-25 : 10:17:45
|
| Thanks Visakh,But I was trying to use the CONTAINS in single queryfor performance tuning issue i am facing( even u looked in)http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=177039Now in order to reduce Index scan Cost % . i was truying to use CONTAINS |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-25 : 10:25:56
|
| ok...then isnt it enough to populate a temporary table with contains result, index it and then use it along with master table in NOT EXISTS condition to get excluded result?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Vishal_sql
Posting Yak Master
102 Posts |
Posted - 2012-07-25 : 10:47:03
|
| But my query is UPDATE @temp_ProjectSETEACRevenue = pbrs.EACRevenueFROM(select p.ProjectCode,p.RevisionNum,sum(p.EACRevenue) AS EACRevenueFROM (Select a.ProjectCode, a.RevisionNum, ISNULL(a.NegotiatedChargeAmt,0) AS EACRevenuefrom ProjectRuleBillingSchedule a, TaskRule tr, Task twhere a.ProjectCode = tr.ProjectCodeAND a.RevisionNum = tr.RevisionNumAND a.TaskUID = tr.TaskUIDAND a.ProjectCode = t.ProjectCodeAND a.RevisionNum = t.RevisionNumAND a.TaskUID = t.TaskUIDAND t.TaskName not like 'Billable Expense%'AND tr.BillTypeCode = 'F')p GROUP BY p.ProjectCode, p.RevisionNum) pbrs,@temp_Project TPWHERE TP.ProjectID = pbrs.ProjectCodeAND TP.RevisionNum = pbrs.RevisionNumand u are suggesting 1) to put the taskname from Task table into some temp table first and2) then Join it in above query. If thats case then do u think it reduces the performance or we are allowing Engine to do more work ?But u suggested intersting point.But m not sure does it help in performance tuning? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-25 : 11:33:57
|
| what all indexes does task table have curently?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Vishal_sql
Posting Yak Master
102 Posts |
Posted - 2012-07-25 : 13:50:18
|
| Task table hasNonClustered index on ProjectCode ,RevisionNum ,TaskUID and i created separate one more Non Clustered index on column=taskname as it has condition in where clause (AND t.TaskName not like 'Billable Expense%')Now how can be index scan converted into seek ( as cost of index scan is more 48% which i think is bcoz of like operation). |
 |
|
|
|
|
|
|
|