Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

One query works, another doesnt'

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
bhermer
Asked:
bhermer
  • 4
  • 2
1 Solution
 
bhermerAuthor Commented:
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
 
Einstine98Commented:
why don't you use like '%A2104011%' and see if this makes any difference? or are you actually using text search?
0
 
bhermerAuthor Commented:
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Einstine98Commented:
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
 
bhermerAuthor Commented:
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
 
bhermerAuthor Commented:
Thanks alot, yes it was the indexing, and yes I am an idiot for not realizing.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now