Record not getting filtered using like clause

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite
1












Using below query to filter records:



select * from SearchRecord where searchkeyword1 like '[%'


Tried this also



select * from SearchRecord where searchkeyword1 like '%[%'


Records in table contain these values (as per below i need last 2 records, why this simple like won't filter records)



"Affiliate" means
"Agent's Rate of Exchange" means
["Aggregate Total Commitments" means
["Agreed Security Principles" means









share|improve this question



























    up vote
    1
    down vote

    favorite
    1












    Using below query to filter records:



    select * from SearchRecord where searchkeyword1 like '[%'


    Tried this also



    select * from SearchRecord where searchkeyword1 like '%[%'


    Records in table contain these values (as per below i need last 2 records, why this simple like won't filter records)



    "Affiliate" means
    "Agent's Rate of Exchange" means
    ["Aggregate Total Commitments" means
    ["Agreed Security Principles" means









    share|improve this question























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      Using below query to filter records:



      select * from SearchRecord where searchkeyword1 like '[%'


      Tried this also



      select * from SearchRecord where searchkeyword1 like '%[%'


      Records in table contain these values (as per below i need last 2 records, why this simple like won't filter records)



      "Affiliate" means
      "Agent's Rate of Exchange" means
      ["Aggregate Total Commitments" means
      ["Agreed Security Principles" means









      share|improve this question













      Using below query to filter records:



      select * from SearchRecord where searchkeyword1 like '[%'


      Tried this also



      select * from SearchRecord where searchkeyword1 like '%[%'


      Records in table contain these values (as per below i need last 2 records, why this simple like won't filter records)



      "Affiliate" means
      "Agent's Rate of Exchange" means
      ["Aggregate Total Commitments" means
      ["Agreed Security Principles" means






      sql-server






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 37 mins ago









      user3657339

      273




      273




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Your search pattern contains a wildcard character [,
          you should enclose it in brackets or use ESCAPE character like this:



          declare @SearchRecord table (searchkeyword1 varchar(100));
          insert into @SearchRecord values
          ('"Affiliate" means'),
          ('"Agent''''s Rate of Exchange" means'),
          ('["Aggregate Total Commitments" means'),
          ('["Agreed Security Principles" means');

          select *
          from @SearchRecord
          where searchkeyword1 like '![%' ESCAPE '!';

          select *
          from @SearchRecord
          where searchkeyword1 like '[%';


          All this is described here:
          LIKE (Transact-SQL)






          share|improve this answer



























            up vote
            1
            down vote













            You can use ESCAPE '<some char>' to tell SQL how to interpret the character after .



            SELECT * FROM SearchRecord WHERE SearchKeyword LIKE '%[%' ESCAPE '';


            db<>fiddle here






            share|improve this answer




















              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "182"
              ;
              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',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f221240%2frecord-not-getting-filtered-using-like-clause%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote



              accepted










              Your search pattern contains a wildcard character [,
              you should enclose it in brackets or use ESCAPE character like this:



              declare @SearchRecord table (searchkeyword1 varchar(100));
              insert into @SearchRecord values
              ('"Affiliate" means'),
              ('"Agent''''s Rate of Exchange" means'),
              ('["Aggregate Total Commitments" means'),
              ('["Agreed Security Principles" means');

              select *
              from @SearchRecord
              where searchkeyword1 like '![%' ESCAPE '!';

              select *
              from @SearchRecord
              where searchkeyword1 like '[%';


              All this is described here:
              LIKE (Transact-SQL)






              share|improve this answer
























                up vote
                3
                down vote



                accepted










                Your search pattern contains a wildcard character [,
                you should enclose it in brackets or use ESCAPE character like this:



                declare @SearchRecord table (searchkeyword1 varchar(100));
                insert into @SearchRecord values
                ('"Affiliate" means'),
                ('"Agent''''s Rate of Exchange" means'),
                ('["Aggregate Total Commitments" means'),
                ('["Agreed Security Principles" means');

                select *
                from @SearchRecord
                where searchkeyword1 like '![%' ESCAPE '!';

                select *
                from @SearchRecord
                where searchkeyword1 like '[%';


                All this is described here:
                LIKE (Transact-SQL)






                share|improve this answer






















                  up vote
                  3
                  down vote



                  accepted







                  up vote
                  3
                  down vote



                  accepted






                  Your search pattern contains a wildcard character [,
                  you should enclose it in brackets or use ESCAPE character like this:



                  declare @SearchRecord table (searchkeyword1 varchar(100));
                  insert into @SearchRecord values
                  ('"Affiliate" means'),
                  ('"Agent''''s Rate of Exchange" means'),
                  ('["Aggregate Total Commitments" means'),
                  ('["Agreed Security Principles" means');

                  select *
                  from @SearchRecord
                  where searchkeyword1 like '![%' ESCAPE '!';

                  select *
                  from @SearchRecord
                  where searchkeyword1 like '[%';


                  All this is described here:
                  LIKE (Transact-SQL)






                  share|improve this answer












                  Your search pattern contains a wildcard character [,
                  you should enclose it in brackets or use ESCAPE character like this:



                  declare @SearchRecord table (searchkeyword1 varchar(100));
                  insert into @SearchRecord values
                  ('"Affiliate" means'),
                  ('"Agent''''s Rate of Exchange" means'),
                  ('["Aggregate Total Commitments" means'),
                  ('["Agreed Security Principles" means');

                  select *
                  from @SearchRecord
                  where searchkeyword1 like '![%' ESCAPE '!';

                  select *
                  from @SearchRecord
                  where searchkeyword1 like '[%';


                  All this is described here:
                  LIKE (Transact-SQL)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 19 mins ago









                  sepupic

                  6,203716




                  6,203716






















                      up vote
                      1
                      down vote













                      You can use ESCAPE '<some char>' to tell SQL how to interpret the character after .



                      SELECT * FROM SearchRecord WHERE SearchKeyword LIKE '%[%' ESCAPE '';


                      db<>fiddle here






                      share|improve this answer
























                        up vote
                        1
                        down vote













                        You can use ESCAPE '<some char>' to tell SQL how to interpret the character after .



                        SELECT * FROM SearchRecord WHERE SearchKeyword LIKE '%[%' ESCAPE '';


                        db<>fiddle here






                        share|improve this answer






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          You can use ESCAPE '<some char>' to tell SQL how to interpret the character after .



                          SELECT * FROM SearchRecord WHERE SearchKeyword LIKE '%[%' ESCAPE '';


                          db<>fiddle here






                          share|improve this answer












                          You can use ESCAPE '<some char>' to tell SQL how to interpret the character after .



                          SELECT * FROM SearchRecord WHERE SearchKeyword LIKE '%[%' ESCAPE '';


                          db<>fiddle here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 18 mins ago









                          McNets

                          13.1k41554




                          13.1k41554



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f221240%2frecord-not-getting-filtered-using-like-clause%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              List of Gilmore Girls characters

                              Confectionery