Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:52:11+00:00 2026-06-17T06:52:11+00:00

Need help in below. I am using sql seerver 2008 and have a query

  • 0

Need help in below.

I am using sql seerver 2008 and have a query in which i am using like operator.
when i am using a part of string then its working fine however when i am using complete string in like operator database is not populating any results.

for example.
i have table EMp which containd description column.
if descreption column contains

Description
-------------------------------------------------
'John joined on Wednesday/CELL PHONE [1234567890]'

when i am writing query

select * from EMp where 
description like '%CELL%'

its working fine
however when i am writing my query as

select * from EMp where 
description like '%John joined on Wednesday/CELL PHONE [1234567890]%'

its not returning any value.

does it mean that like operator works only part of string and not on full string.
I have also tried LTRIM and RTRIM just to make sure that space is not a problem however its not working.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:52:12+00:00Added an answer on June 17, 2026 at 6:52 am

    Keep in mind that LIKE supports a limited set of pattern matches in addition to the wildcard %. One of those patterns includes brackets for matching a range.

    See: http://msdn.microsoft.com/en-us/library/ms179859.aspx

    The brackets in your query will cause it to search for “Any single character within the specified range ([a-f]) or set ([abcdef]).”

    description like '%John joined on Wednesday/CELL PHONE [1234567890]%'
    

    Thus, your query is asking for SQL Server to find a character within the set [1234567890].

    If you read through the MSDN documentation, it provides guidelines for using wildcard characters as literals. Here’s a little example:

    DECLARE @table TABLE ( SomeText VARCHAR( 100 ) );
    INSERT @table ( SomeText ) VALUES ( 'here is a string with [brackets]' );
    
    -- matches with wildcards on both sides of the pattern
    SELECT * FROM @table WHERE SomeText LIKE '%[brackets]%';
    
    -- won't match
    SELECT * FROM @table WHERE SomeText LIKE '%here is a string with [brackets]%';
    
    -- matches, because expression is escaped
    SELECT * FROM @table WHERE SomeText LIKE '%here is a string with [[brackets]%';
    
    -- a confusing (but valid) escape sequence AND a wildcard
    SELECT * FROM @table WHERE SomeText LIKE '%here is a string with [[][a-z]rackets]%';
    

    Note that full text indexing may be more useful if you want to search larger strings with more complex patterns. It is supported in all editions of SQL Server 2008 (even Express).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help on concatenation. I have a Title which is displayed below like
I have a table like below (using SQL server 2008 R2): CREATE TABLE [dbo].[Data](
need help in error in database pivot. i have table tamed table_score like below:
I have a csv file with data looking like (see below). I need help
Hi guys I need to rewrite the sql query below using Linq to entity.
Hi need help getting repeated value from give array,below is the code which im
I need help with the SQL ORDER BY clause. In my table below I
I need to make a rather complex query, and I need help bad. Below
There is a problem I need help with your query on the data using
I need help re-factoring this legacy LINQ-SQL code which is generating around 100 update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.