using the LIKE operator with wildcards to match names

I use SQL in ColdFusion 9 to match the names of a table in MS Access 2003 database.

The field of visitors to MyTable contains the name of 'Smith' in six records.

1 Wilson Jones Smith

2. Smith, Jones, Wilson

3. Smith(Jr.), Jones, Wilson

4 Jones Wilson Smith

5 Wilson Smith Jones

6. Smith

7 Smithson, Jones, Wilson

8 Jones, Wilson, Arrowsmith


To find records that contain the name Smith (but), I now have to write four lines "OR":

WHERE myField LIKE ' Smith [! a-zA-Z] %' (find only the Smiths in documents 1, 2 and 3) 

OR MyField AS ' % [! a-zA-Z] Smith ' (detects only the Smith in folder 4)

OR MyField AS ' % [! a-zA-Z] Smith [! a-zA-Z] %' (find only Smith in folder 5)

OR MyField = 'Smith' (detects only the Smith in the form 6)  

I would like to know how to combine these four lines into one that would find all six records with Smith.

Thank you for your help.




I think that the way you did it is the best. Since the word that Smith can occur at the beginning, middle or end of a string, it is difficult to write a single regular expression to cover all cases. Even if you could, it would be a complicated formula indeed.

Tags: ColdFusion

Similar Questions

  • By using the IN operator with a slider?

    Hi guys, how can I go on the use of the IN operator with a slider?

    For example, I have a slider that is a range to match dates. I want to use these results to compare via an IN operator in a WHERE clause.

    Thanks :)

    You can do this way
    Use EXECUTE IMMEDIATE with into clause.

    InClause := '( your in values ) ';
    
    execute immediate 'select xyz from abc where xyz in '||inClause  into var1 ; 
    

    SS

  • Using the Pivot operator with percentages

    I use Oracle 12 c DB. I'm trying to use the SQL pivot operator to give me an output of the matrix. I need to display 2 separate outputs, one with the charges and another with percentages. I have the following SQL to get the counties, but I don't know exactly on the SQL for the percentages. Please notify. TX

    with pivot_data as (select 'score', 'Observer_LastName', 'profile_id'

    FROM MyTable

    where substr ("Observer_LastName", 1, 1) s = ')

    SELECT *.

    of pivot_data

    PIVOT (count ("profile_id")

    FOR 'partition' IN ('0', '1', '2',' 3')

    )

    Hello

    Using the table from scott.emp provided by Oracle, which has these counts for deptno and job:

    WORK DEPT_10 DEPT_20 DEPT_30

    --------- ------- ------- -------

    ANALYST 2

    CLERK 1 2 1

    MANAGER 1 1 1

    PRESIDENT 1

    SELLER 4

    You can get out of the percentages, like this:

    WORK DEPT_10 DEPT_20 DEPT_30

    --------- ------- ------- -------

    ANALYST OF 100.00

    THE CLERK 25.00 50.00 25.00

    MANAGER OF 33.33 33.33 33.33

    PRESIDENT 100.00

    SELLER 100.00

    using a query like this:

    WITH pivot_data AS

    (

    SOME jobs, deptno

    100 * RATIO_TO_REPORT (COUNT (*))

    RESUMED (work PARTITION) AS pct

    FROM scott.emp

    Working GROUP, deptno

    )

    SELECT *.

    OF pivot_data

    PIVOT (MIN (pct)

    TO deptno IN (10 AS dept_10

    20 AS dept_20

    30 AS dept_30

    )

    )

    ORDER BY job

    ;

  • Filter Table ADF | with the Like operator

    Dear all,

    I use JDeveloper 12 c.

    I have an obligation to provide the filter on the table with the 'Like' operator

    I'm following Ashish Awasti method on it. Ashish Awasthi (Jdev/ADF) Blog: filter on af:table column programmatically, Invoke 'FilterableQueryDescriptor' t...

    All very well here. In "FilterableQueryDescriptor" default search operator is "begins by". Is it possible to change the operator "starts by ' to 'Like' operator.

    Please suggest.

    Thank you

    Vieira

    An addition: If the op just wants to use the like operator, it must use the data of the field in the table, as is. View implizite criteria build for filter uses

    (((Countries.COUNTRY_NAME COMME (: bindName ||))) (('%')) OR (: bindName IS NULL)))

    for the startswith operator.  Yes ther EI '%' added automatically. It should be replaced by

    (((Countries.COUNTRY_NAME COMME (: bindName)) OR (: bindName IS NULL)))

    to be a true sql 'like' operator. Then, the user must enter the filter with the '%' residue criteria to perform a generic search.

    Adding a '%' before the setting is counterproductive because it can be a bottleneck. The PB needs to do a full table scan to get the result!

    Then it would not behave as the sql like operator that you can search for '? URO % "for"europa". If, for example, a line with "western europe" is your setting ' %? % ships ' grab this line too.

    Timo

  • By using the negative operator

    I am very new to oracle and works collaboratively with the negative operator to run a query. I could use some help!

    Here's the query I'm working on that:

    Select the provider name, partname
    quote
    where partname = "hammer".
    less
    Select the provider name, partname
    quote
    where partname = "hammer";

    HOW CAN I GET THE QUERY TO DISPLAY ONLY THE ROWS OF SUPPLIERNAMES THAT PROVIDE ONLY HAMMERS?
    I WOULD BE VERY HAPPY FOR CLARIFICATION.

    You did not if you use LESS, or you just want to. I guess for now by using LESS that it is a requirement.

    Experiment with the SQL you are using. Add predicates in the WHERE clause to get precisely the lines you want for both queries. Remember that the results for LESS than will take the results of the first query and delete the second query results with the values returned by the first query not returned by the second result.

    Also remember that comparisons of strings in Oracle are dependent case. Your query used 'Hammer' - tiny - but the information you listed used "HAMMER" - uppercase. These are different values and will not match. I'm not sure that you want to search for 'HAMMER' in the second query if you want to remove the other values - you may need to check the values that are not "HAMMER" instead.

    In addition, you used the LIKE operator without a wildcard "%" or "_". AS no Joker becomes =.

  • How to use 'not like' operator in BI Publisher

    We build a report using BI publisher and need to put a check where you should see only the lines where the code does not start with S. We are aware of the starts - with operator in BI publisher, but when we try to use it with no, BI publisher generates an error. Can you please let us know how to use the not operator with "starts - with" or "contains" bi publisher?

    Also how to use 'not like' operator in BI Publisher?

    Any help will be really appreciated.

    Thank you

    You can use

    not(starts-with(ELEMENT_NAME, 'A')
    
  • to use the NOW() function with operator (such as NOW () - 120) 11.1.1.6.11 or 11.1.1.7.1

    Hi all

    I want to use the function NOW with a different operator in obiee11.1.1.6.11 or 11.1.1.7.1

    but every time I have a creating a filter as

    TRAN_DATE is equal to NOW()-120, we become "an arithmetic operation is being performed on a non-digital type.»

    11.1.16.11 and 11.1.1.7.1

    Hare TRAN_DATE is in RPD datetime data type

    Can someone tell me how to replace the error and make the report run and return the results

    Do now () - 120 is a very simplistic way to look at it because it is highly ambiguous. IE: NOW less 120 "what?" Minutes? Seconds? Years? Petroleum products?

    Accuracy is the key. Now() gives a timestamp (a real timestamp DATA TYPE object!), so I guess you mean days.

    Timestamp data types are changed (projected through time) using the TIMESTAMPADD function, which in your case would by this formula:

    TIMESTAMPADD (SQL_TSI_DAY,-120, NOW()))

  • Do I need to use the software provided with the wireless hardware to go wireless? __

    I have a router Linksys Wireless (wrt160n) that I am not using. I whant to buy a (Linksys WUSB600N) for my office. I want to know if I need to use the software supplied with the hardware, or can I just use Microsoft Wizard to configure my network? Operating system is Vista Premium.

    Thank you Jeremy will do.

  • How to use the Muse Widgets with Dreamweaver presentations

    I've been building websites with Dreamweaver for years

    -are particularly interested in some of the Widgets Muse and you're wondering how to integrate to existing sites built with DW?

    Please notify

    WillzShire

    Although it is possible to export the model Muse in Dreamweaver, I would advise not to do. At this stage of his development, Muse is very suited for the HTML/CSS illiterate. But once you want to create interactivity as a contact form, you will need to encode the file using the likes of Dreamweaver. Once you have worked on the file in Dreamweaver, you cannot return to the use of Muse for changes.

    With the foregoing in mind, if you have a knowledge of HTML/CSS, there should be no reason to use the Muse; all of the widgets used in Muse are available for Dreamweaver, but in another format.

  • Trying to export using the preset "Quicktime" and "Source of Match."

    I try to export my video using the "Quicktime" parameter with the preset "Match Source (wrap)". When I do that on my computer at home, everything works fine.  On the work computer ym, an error message appears saying, "the video stream of the source file are not compatible with this preset. Please change to another preset. "I tired using the video from 3 different sources and received the same error message.  This preset works on my computer at home very well. What I'm doing wrong, because I want to export, have a great quality?

    Game of QuickTime source (wrap) is only supported for a number of compatible video stream. These are mainly supported codecs to make them smart. These include most of the combinations of the following QuickTime codecs: Animation, Apple ProRes (4444 & 422 flavors), DV (25, 50 & DVCPROHD), GoPro CineForm and None. If your source clips are not one of these codecs, then Source Match of QuickTime (wrap) is not supported and will provide the warning, you mentioned.

    I hope this helps.

  • Anyone use the < cfdocument > tag with a < cfloop >

    Anyone use the < cfdocument > tag with a < cfloop >

    I'm generating more documents like this.

    < cfloop query = "myquery" >

    < cfdocument type = pdf >

    < html >... .HTML code here... < html >

    < / cfdocument >

    < / cfloop >

    But only the first document is generated in the browser?



    My requirement that I want to create multiple PDF and publish to folder and zip folder so that the user can able to download the ZIP file


    Thanks in advance

    My requirement that I want to create multiple PDF and publish to folder and zip folder so that the user can able to download the ZIP file

    (1) create a folder named, say, docsDir, in the current directory.

    (2) create PDF files, using suggestion of Eddie Lotter, name each file dynamically and store them in the folder docsDir.

    Insert here the code to generate the content of #filename # .

    (3) zip file, docsDir, store the resulting file, docsDir.zip, in the current directory.

  • ORA-00900 when you use the command COPY with dynamic SQL

    Helllo,
    I created the following procedure:

    create or replace procedure copyTable (pSourceTableOwner IN varchar2
    pSourceTableOwnerPasword IN varchar2
    pTargetTableOwner IN varchar2
    pTableName IN varchar2
    pDatabaseLink IN varchar2)
    as

    vStatement varchar2 (250): = null;

    Start

    vStatement: = "copy of". pSourceTableOwner | '/' || pSourceTableOwnerPasword | '@' || pDatabaseLink |
    "Insert" | pTargetTableOwner | '.' || pTableName | ' using select * from '. pTableName;

    immediately run vStatement;

    end;
    /

    The generated command (variable vStatement) looks like this:
    "Insert a copy of O_GLCEN/o_glcen@SELLENTW o_jh. "X_PLZ_CD_MERGED_CTIS using select * from X_PLZ_CD_MERGED_CTIS".

    When you call this procedure as "exec copyTable ('O_GLCEN', 'o_glcen', 'o_jh', 'X_PLZ_CD_MERGED_CTIS', 'SELLENTW');" the following lifts:

    FEHLER in line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at "SYSTEMTECHNIK". COPYTABLE", line 20
    ORA-06512: at line 1

    But when you call the command COPY directly from SQL prompt the statement runs without error.
    Is in general not possible to use the dynamic COPY with SQL command? If it is possible does anyone has an idea what I am doing wrong?

    Any help will be appreciated...

    Rgds
    JH

    I would like to use something like

    vStatement: = ' start in f (select * from ' | pSourceTableOwner |) '.' || pTableName | '@' || pDatabaseLink | Insert loop ') in ' | pTargetTableOwner | '.' || pTableName | "f-values; end loop; end; »
    immediately run vStatement;

  • Is it possible to use the Remote app with the Apple TV connected via ethernet and iPhone via WiFi?

    Is it possible to use the Remote app with the Apple TV connected via ethernet and iPhone via WiFi? When I try this Apple TV does not appear in the list of devices on my iPhone.

    Yes, I'm doing exactly this with the same put in place.

    If the problem persists the next relative to the following articles might help you.

    Troubleshooting home sharing

  • When I use the mail merge with excel file, after I press ok the progress bar indicates "NaN", mail project window crashes. My record is nice little CVS n

    When I use the mail merge with excel file, after I press ok of the progress bar indicates "NaN", mail project window crashes. My file is in the correct format and small size (4-column 4 raws). I use an English version of thunderbird after accidentally, I installed one in my tongue.

    I am attaching the screenshot

    I solved the problem
    has been st@pid excel

    I created a CSV file in openoffice calculator and everything went smoothly

  • Win7 with FF 31, smart phone 4.2 with FF letest ver. using the same account with 1 email. But the phone is not getting any collar, Bokmr, etc.

    Brother.
    We use win7 with Mozila 31, 4.2 with Mozila Android smart phone latest google app store on 04/10/0214. Using the same account with the same email. But the phone does not get any new information of win7 with Mozila 31. PL z give useful information.

    Hi w3ur_team,
    Thank you for your question. I understand that there are two features that are documented in the sync account. However the Android is not synchronized.

    There are two places we can check:

    1. In the Android settings, under accounts is the Firefox Sync or Firefox Sync (discouraged) joint account?
    2. Credentials work on accounts.firefox.com on the mobile device and are there any error messages in the synchronization of the settings menu > sync?

    See also Firefox Sync troubleshooting and tips for more troubleshooting steps.

Maybe you are looking for

  • Photosmart Premium Fax series: error code 11471108

    Received error code 11471108 when you try to print from my desktop Gateway computer?   JP

  • Vista SP2 problems

    Last night my PC crashed. After several reboots, I got the blue screen of death. My Dell is only 1 year and a half old. My heart stopped, and then my brain started to run. I have change or update?The answer? I've updated to Vista SP 2. To compound my

  • How to install the Microsoft Isatap, Teredo Tunneling adapter Microsoft, 6to4 adapt card

    Can you explain me please, how can I solve tis problem. I don, t know where I can find this adapters, because they are not installed on my computer. The computer asks me to solve this problem. Is there a link on the internet for download? Or another

  • Future decision-making support Windows 7 Ultimate & updates to date?

    I tried to find a definitive answer to my question of whether or not my OS Windows 7 Ultimate will continue to be supported and updated with latest 2015. I can't find any answer to this question... anyone have an idea?  I only had my os for about 5 y

  • YouTube never works on my Windows 7.

    Original title: a lot of questions. My utube never works over https, Buy https for my own pc and no wifi? on many sites, I see https and no green lock, instead, the https protocol is present with a warning sign that my data may be compromised, what c