Solved

One query works, another doesnt'

Posted on 2006-07-20
7
230 Views
Last Modified: 2008-02-26
Hi,

This is going to be a hard question to answer as you dont have access the the server, but I have some very strange behaviour going on. I really need some trouble shooting tips to help me diagnois the problem:

The Problem:

This works:

SELECT     *
FROM         dbo.SmartPart
WHERE     CONTAINS(Description, 'A2101010') OR
                      CONTAINS(CPC_Code, 'A2101010') OR
                      CONTAINS(pkg_type, 'A2101010')


But this doesn’t

SELECT     *
FROM         dbo.SmartPart
WHERE     CONTAINS(Description, 'A2104011') OR
                      CONTAINS(CPC_Code, 'A2104011') OR
                      CONTAINS(pkg_type, 'A2104011')


Both the records are there and both have data in them, one returns a result, one doesn't and I have no idea where to start

The data fields coppied directly from enterprise manager:

      A2101010      R 1K58 1% 0603 1      1.58      KO      2KO      1%      1%      0.1      W      RES0603      1.55 mm      .85 mm      .45 mm      res      RES0603      0603      http://smartpart.europe.bkhm.net/components/moreinfo.asp?CPC_Code=A2101010      Yes      R_1K58_1%_0603_1      Yes      \\zpgty0x0.europe.bkhm.net\users\Smartpart\SmartPartData\CPC_Codes\A21\A2101\A2101010\PDF\A2101010.pdf      DX Designer      No      Chip_Resistor      Vishay.                              CRCW_0603_1581_F_100                              http://www.vishay.com                              Pending      Pending      Pending      Pending      Pending       


      A2104011      R 1K58 1% 0603 1      1.58      KO      2KO      1%      1%      0.1      W      RES0603      1.55 mm      .85 mm      .45 mm      res      RES0603      0603      http://smartpart.europe.bkhm.net/components/moreinfo.asp?CPC_Code=A2101010      Yes      R_1K58_1%_0603_1      Yes      \\zpgty0x0.europe.bkhm.net\users\Smartpart\SmartPartData\CPC_Codes\A21\A2101\A2101010\PDF\A2101010.pdf      DX Designer      No      Chip_Resistor      Vishay.                              CRCW_0603_1581_F_100                              http://www.vishay.com                              Pending      Pending      Pending      Pending      Pending       
0
Comment
Question by:bhermer
  • 4
  • 2
7 Comments
 
LVL 4

Author Comment

by:bhermer
ID: 17144852
Table Design, should it help

3      CPC_Code      varchar      16      0
0      Description      varchar      255      1
0      Electrical_Value      float      8      1
0      Electrical_Unit      varchar      50      1
0      [Value]      varchar      50      1
0      Tol_Plus      varchar      50      1
0      Tol_Minus      varchar      50      1
0      Rating      float      8      1
0      Rating_Unit      varchar      50      1
0      Package_Style      varchar      50      1
0      Body_Length      varchar      50      1
0      Body_Width      varchar      50      1
0      Body_Height      varchar      50      1
0      Symbol      varchar      250      1
0      pkg_type      varchar      70      1
0      Device      varchar      50      1
0      Web_Page      varchar      250      1
0      InPads      varchar      50      1
0      PadsName      varchar      50      1
0      Fitted      varchar      50      1
0      Datasheet_Path      varchar      250      1
0      Tool      varchar      50      1
0      RC      varchar      50      1
0      ComponentType      varchar      50      1
0      Mnf_1      varchar      50      1
0      Mnf_2      varchar      50      1
0      Mnf_3      varchar      50      1
0      Mnf_4      varchar      50      1
0      Mnf_5      varchar      50      1
0      Mnf_1_PartNum      varchar      100      1
0      Mnf_2_PartNum      varchar      100      1
0      Mnf_3_PartNum      varchar      100      1
0      Mnf_4_PartNum      varchar      100      1
0      Mnf_5_PartNum      varchar      100      1
0      Mnf_1_Web      varchar      100      1
0      Mnf_2_Web      varchar      100      1
0      Mnf_3_Web      varchar      100      1
0      Mnf_4_Web      varchar      100      1
0      Mnf_5_Web      varchar      100      1
0      Mnf_1_App      varchar      50      1
0      Mnf_2_App      varchar      50      1
0      Mnf_3_App      varchar      50      1
0      Mnf_4_App      varchar      50      1
0      Mnf_5_App      varchar      50      1
0      Preferred      varchar      50      1
0
 
LVL 12

Expert Comment

by:Einstine98
ID: 17144859
why don't you use like '%A2104011%' and see if this makes any difference? or are you actually using text search?
0
 
LVL 4

Author Comment

by:bhermer
ID: 17144909
We have created the algorithums for searching and they are pretty bug free and complex, we cannot start changing them (My manager would freak out!), The CONTAINS has been working for over2 years, the only difference now is the way we input the data into the SQL box, we were using a vb recordset, ie. rs.addnew, rs.update. We have now bought a third party library tool which is creating them with,I presume INSERT statements.

When I run this in enterprise manager I get both records returned:

SELECT     *
FROM         dbo.SmartPart
WHERE     (CPC_Code = 'A2101010') OR
                      (CPC_Code = 'A2104011')
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 17144939
I assume that the full-text index has not been updated since the insert of the record that does not get returned.
check the schedule of the full-text catalog update
0
 
LVL 12

Expert Comment

by:Einstine98
ID: 17144941
if you get it right from query analyzer or enterprise manager then your problem should be in your code or the library that you are talking about... not much help I can provide there!
0
 
LVL 4

Author Comment

by:bhermer
ID: 17144963
My Guess is that AngelIII is right, dont I feel like an idiot!, trouble is we are installing this new software for the first time today and have desperatly been trying to test it, not realizing the indexing wont happen until midnight tonight! I will see if I can get my Server admin team to initiate an index, if not I will test again tomorrow and (Hopefully) award points to AnglelIII

Thanks
0
 
LVL 4

Author Comment

by:bhermer
ID: 17145328
Thanks alot, yes it was the indexing, and yes I am an idiot for not realizing.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now