Stored proceedure and cursor

  • OK i did like this but now this shows me those records too which do not match...mean when their counter field is 0...

    select TOP 5 COMPANY,CategoryName,comp_kws,locStr,

    len(COMPANY) - len(replace(COMPANY, 'ltd', '')) as cntcmp ,

    len(CategoryName) - len(replace(CategoryName, 'ltd', ''))

    as cntcat,

    len(comp_kws) - len(replace(comp_kws, 'ltd', ''))

    as cntkey,

    len(locStr) - len(replace(locStr, 'ltd', ''))

    AS cntStr

    from vwSearchResult

    GROUP BY COMPANY,CategoryName,comp_kws,locStr

    order by cntcmp DESC,cntcat DESC,cntkey DESC,cntStr DESC

    In this case cntStr is Zero for all five records.I want to check if it is Zero then Do not show any thing.how it could be.....when i put where cntStr>0..it give me error

  • select ...

    from vwSearchResult

    where (len(COMPANY) - len(replace(COMPANY, 'ltd', '')) + len(CategoryName) - len(replace(CategoryName, 'ltd', '')) + len(comp_kws) - len(replace(comp_kws, 'ltd', '')) + len(locStr) - len(replace(locStr, 'ltd', ''))) > 0

    GROUP BY ...

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Very Good Job

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply