• greg6363 (2/14/2016)


    [Err... Seek and scan are SQL's two internal operations for accessing indexes, they're not something you explicitly use.

    What exactly are you trying to do? Post table definitions (as CREATE TABLE statements) and sample data (as INSERT statements) please]

    I need to extract the same string from two tables. I can use the SUBSTRING function to pull the alpha-numeric sequence from the first table since it is always in the same position in the field but I need to pull the same alpha-numeric sequence from a text field in the second table and the sequence is not always in the same position within the field. What code do I use so I can match the alpha-numeric sequence between the two tables? Any assistance would be greatly appreciated. Thanks.

    You'll need to use a mid-string LIKE or a CHARINDEX to find the string in the table where the position is unknown. There is no way that will occur with any decent performance. The entire column will need to be scanned.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)