C# Matched Wildcard?? How to Find

Posted on 2008-11-06
Last Modified: 2012-05-05


I have two tables. One contains patterns and other contain raw data.

Table_A contains data
Table_B contains Patterns

Select * from Table_A where namea in
(Select '%'+nameb+'%' from Table_B)

I m trying to concatenate nameb with '%' so that it will be used
as wild card for searching in namea.

How can i find which nameb contains within namea??

Question by:zeeshanhayder
    LVL 7

    Accepted Solution

    This is obviously an SQL question, but I'll give it a try.
    Be aware than the concat syntax is Databe specific (e.g. '+' for MsSql or '&' for Access)
    You can cross the data and the patterns, and then test for a match (with like):

    SELECT AS data, '%' + Table_B.pattern + '%' AS pattern
    FROM Table_A CROSS JOIN Table_B
    WHERE data LIKE pattern;

    Open in new window

    LVL 26

    Expert Comment

    by:Anurag Thakur
    what do you mean by patters - are they simple strings or Regular Expression Patterns?

    Author Comment

    Well Moseack your answer was sumwhat correct.

    Slight modification is needed
    Following SQL statement worked for Me
    SELECT AS data, Table_B.pattern as pattern
    FROM Table_A CROSS JOIN Table_B
    WHERE LIKE '%' + Table_B.pattern + '%';

    Open in new window


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now