String Search SQL help needed .....

  • What I really need is to find the entries that have the word LVAD but on either side there should be a space chartacters.

    In other words I don't want to see the following coming from the query "SILVADENE ([PHI] SULFADIAZINE)"

    How can we write this query to search only for any entry that has the word " LVAD " ?

    Select top 100 * FROM tbl_abc

    where

    AIMS_Value like '%LVAD%'

  • a space in the LIKE is just as valid as any regular char.

    change your like to have the spaces:

    Select top 100 * FROM tbl_abc

    where

    --AIMS_Value like '%LVAD%' --old

    AIMS_Value like '% LVAD %' --new

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • mw112009 (5/11/2015)


    What I really need is to find the entries that have the word LVAD but on either side there should be a space chartacters.

    In other words I don't want to see the following coming from the query "SILVADENE ([PHI] SULFADIAZINE)"

    How can we write this query to search only for any entry that has the word " LVAD " ?

    Also be mindful of you square brackets in your data when using a LIKE statement. If you ever intend to search to include them in the future you'll need to escape the characters as they have a different meaning in a LIKE clause.


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

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

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