Masked SQL Query












-1















is there a function of some kind that can search by masked param? example: pass a 5 char value XDWTR and return all rows that match any char. combinations from another table that has the masked values: AW_, _CH, _DW, _DW,____R. my masked values are always 5 char. this search would return 2 matches the _DW___ because the second and third DW match the second and third value of XDWTR. the other ___DW_ starts in the 3rd pos. so it's not a match. the ____R is a match because it's the last pos. that matches the R in XDWTR.



any helpful example would be great.










share|improve this question


















  • 1





    Please tag your question with the database you are using. How is 'AW_' five characters?

    – Gordon Linoff
    Nov 12 '18 at 20:09













  • In your examples, you need to match at least 2 letters or?

    – Gnqz
    Nov 12 '18 at 20:29
















-1















is there a function of some kind that can search by masked param? example: pass a 5 char value XDWTR and return all rows that match any char. combinations from another table that has the masked values: AW_, _CH, _DW, _DW,____R. my masked values are always 5 char. this search would return 2 matches the _DW___ because the second and third DW match the second and third value of XDWTR. the other ___DW_ starts in the 3rd pos. so it's not a match. the ____R is a match because it's the last pos. that matches the R in XDWTR.



any helpful example would be great.










share|improve this question


















  • 1





    Please tag your question with the database you are using. How is 'AW_' five characters?

    – Gordon Linoff
    Nov 12 '18 at 20:09













  • In your examples, you need to match at least 2 letters or?

    – Gnqz
    Nov 12 '18 at 20:29














-1












-1








-1








is there a function of some kind that can search by masked param? example: pass a 5 char value XDWTR and return all rows that match any char. combinations from another table that has the masked values: AW_, _CH, _DW, _DW,____R. my masked values are always 5 char. this search would return 2 matches the _DW___ because the second and third DW match the second and third value of XDWTR. the other ___DW_ starts in the 3rd pos. so it's not a match. the ____R is a match because it's the last pos. that matches the R in XDWTR.



any helpful example would be great.










share|improve this question














is there a function of some kind that can search by masked param? example: pass a 5 char value XDWTR and return all rows that match any char. combinations from another table that has the masked values: AW_, _CH, _DW, _DW,____R. my masked values are always 5 char. this search would return 2 matches the _DW___ because the second and third DW match the second and third value of XDWTR. the other ___DW_ starts in the 3rd pos. so it's not a match. the ____R is a match because it's the last pos. that matches the R in XDWTR.



any helpful example would be great.







sql






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 19:55









DougDoug

134




134








  • 1





    Please tag your question with the database you are using. How is 'AW_' five characters?

    – Gordon Linoff
    Nov 12 '18 at 20:09













  • In your examples, you need to match at least 2 letters or?

    – Gnqz
    Nov 12 '18 at 20:29














  • 1





    Please tag your question with the database you are using. How is 'AW_' five characters?

    – Gordon Linoff
    Nov 12 '18 at 20:09













  • In your examples, you need to match at least 2 letters or?

    – Gnqz
    Nov 12 '18 at 20:29








1




1





Please tag your question with the database you are using. How is 'AW_' five characters?

– Gordon Linoff
Nov 12 '18 at 20:09







Please tag your question with the database you are using. How is 'AW_' five characters?

– Gordon Linoff
Nov 12 '18 at 20:09















In your examples, you need to match at least 2 letters or?

– Gnqz
Nov 12 '18 at 20:29





In your examples, you need to match at least 2 letters or?

– Gnqz
Nov 12 '18 at 20:29












1 Answer
1






active

oldest

votes


















0














I think you want:



where masked_param like concat('%', masked_value, '%')


If the masked values are really five characters, then the concat() is not necessary:



where masked_param like masked_value


This is using the fact that _ is the escape character in like for any single character.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269207%2fmasked-sql-query%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I think you want:



    where masked_param like concat('%', masked_value, '%')


    If the masked values are really five characters, then the concat() is not necessary:



    where masked_param like masked_value


    This is using the fact that _ is the escape character in like for any single character.






    share|improve this answer




























      0














      I think you want:



      where masked_param like concat('%', masked_value, '%')


      If the masked values are really five characters, then the concat() is not necessary:



      where masked_param like masked_value


      This is using the fact that _ is the escape character in like for any single character.






      share|improve this answer


























        0












        0








        0







        I think you want:



        where masked_param like concat('%', masked_value, '%')


        If the masked values are really five characters, then the concat() is not necessary:



        where masked_param like masked_value


        This is using the fact that _ is the escape character in like for any single character.






        share|improve this answer













        I think you want:



        where masked_param like concat('%', masked_value, '%')


        If the masked values are really five characters, then the concat() is not necessary:



        where masked_param like masked_value


        This is using the fact that _ is the escape character in like for any single character.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 '18 at 20:10









        Gordon LinoffGordon Linoff

        764k35296400




        764k35296400






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269207%2fmasked-sql-query%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Full-time equivalent

            さくらももこ

            13 indicted, 8 arrested in Calif. drug cartel investigation