+ Reply to Thread
Results 1 to 3 of 3

Thread: Sqlserver : Contains Query

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    34

    Sqlserver : Contains Query

    I have a data like 'XYZ ABC BGN' , i want to display the fields that contains ABC but in the middle as ABC can come in the beginning or at the end , i tried the CONTAINS statement but it did not acquire what i need as it show all fields that has 'ABC' .

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    40
    There is a statement similar to contains called 'LIKE' , the solution would be like that :
    Code:
    SELECT * FROM TableName WHERE Field LIKE '%ABC%'
    The % means that there is data in this area so the field that SQL-server is going to look for will be on that format : DATA ABC DATA exactly like you wanted

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    34
    Thank you , it worked , but it is kind of slow .

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts