Looking Up List of Partial Strings

  • Hi,
    I was hoping someone could please help me.... I am using TSQL and was aiming to be able to be able to complete my query by completing the set of partial strings. I have inserted a sample of what I needed to do (see image). Initially, I only have the column names: "Partial Strings" and I have a separate Table named "Lookup List". Limitations are:
    1. No other objects to be used as their unique identifier.
    2. "Partial Strings" have no specific number of characters, and can appear in as little as 2 first characters

  • Don't think it will work unless the first 2 characters of a the strings are unique, so you wouldn't have something like
    Ball
    Bath
    as members of the set. If that's the case, that solution won't work.

  • The first 2 characters is always unique in my data set...

  • carminamae.gonzales - Wednesday, February 27, 2019 6:33 AM

    The first 2 characters is always unique in my data set...

    If you have a number of characters that a string begins with, to find that string on the database you just need a query using like.
    e.g:
    SELECT *
      FROM dbo.[Given List] g
     INNER JOIN dbo.[Separate Table] t 
             ON t.[Lookup List] LIKE g.[Partial String] + '%'

Viewing 4 posts - 1 through 3 (of 3 total)

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