SQL Query

  • I think this is the code you are looking for:

    [font="Courier New"]/*

    Added IsNull because concatenating to a NULL yields NULL.  

    Added ELSE to CASE statements so you keep the same value

    Added Checks of previous keyword column lengths so you only reset 1

    */

    UPDATE PRO

            SET Prokw1 = CASE

                               WHEN LEN(ISNULL(Prokw1, '') + ', HL7') <= 240 THEN ISNULL(Prokw1, '') + ', HL7'

                               ELSE Prokw1

                           END,      

               Prokw2 = CASE

                               WHEN LEN(ISNULL(Prokw1, '') + ', HL7') > 240 AND LEN(ISNULL(Prokw2, '')  + ', HL7') <= 240

                                           THEN ISNULL(Prokw2, '')  + ', HL7'

                               ELSE Prokw2

                           END,

               Prokw3 = CASE

                               WHEN LEN(ISNULL(Prokw1, '') + ', HL7') > 240 AND LEN(ISNULL(Prokw2, '') + ', HL7') > 240 AND

                                           LEN(ISNULL(Prokw3, '') + ', HL7') <= 240 THEN ISNULL(Prokw3, '') + ', HL7'

                               ELSE Prokw3

                           END

    FROM

       PRO INNER JOIN

       RES ON

           pro.proln=res.resln AND

            pro.profn=res.resfn AND

            pro.Promi=res.resmi

    WHERE

       Resnar LIKE '%hl7%'

    [/font]

  • Thanks again for your help!

  • Theoretical question - Since this packaged software uses keyword fields that are populated from a user defined index and synonym table.

    How does a Monster.com or Careerbuilder.com do this ?

    Do they rely on massive servers and Full Text indexing, since you cant enter every possible word or synonym in a keyword table?

    Or is there another way ?

    Thanks

  • Don't know how the big sites do it. Probably something like full-text query and some highly proprietary stuff as well.

  • DECLARE @myvar nvarchar(240)

    SET @myvar = 'BLING'

    UPDATE PRO

    SET Prokw1 = CASE

    WHEN LEN(ISNULL(Prokw1, '') + ', (@myvar)') <= 240 THEN ISNULL(Prokw1, '') + ', (@myvar)'

    ELSE Prokw1

    END,

    Prokw2 = CASE

    WHEN LEN(ISNULL(Prokw1, '') + ', (@myvar)') > 240 AND LEN(ISNULL(Prokw2, '') + ', (@myvar)') <= 240

    THEN ISNULL(Prokw2, '') + ', (@myvar)'

    ELSE Prokw2

    END

    FROM

    PRO INNER JOIN

    RES ON

    pro.proln=res.resln AND

    pro.profn=res.resfn AND

    pro.Promi=res.resmi

    WHERE

    Resnar LIKE '%oneworld%'

    How do i get the declared value in @myvar into the database?

    I have tried in parenthasis, double quotes and on its own. Nothing works!

    Thanks

  • Replace the occurrences of ', (@myvar)' in your code with ',' + @myvar. 🙂

    --SJT--

  • Aha!

    Works great.

    Many Thanks 😀

  • Google publishes there solution.

    "Bigtable: A Distributed Storage System for Structured Data"

    http://labs.google.com/papers/bigtable.html

    Bigtable is a distributed storage system for managing structured data that is designed to scale to a very large size: petabytes of data across thousands of commodity servers. Many projects at Google store data in Bigtable, including web indexing, Google Earth, and Google Finance. These applications place very different demands on Bigtable, both in terms of data size (from URLs to web pages to satellite imagery) and latency requirements (from backend bulk processing to real-time data serving). Despite these varied demands, Bigtable has successfully provided a flexible, high-performance solution for all of these Google products. In this paper we describe the simple data model provided by Bigtable, which gives clients dynamic control over data layout and format, and we describe the design and implementation of Bigtable.

    Read the fine print of this solution as it does NOT guarantee data integrity and missing updates are allowed !

    SQL = Scarcely Qualifies as a Language

Viewing 8 posts - 16 through 22 (of 22 total)

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