How to use wild Char for selecting a field using WHERE

  • Hi,

    I am a newbie. can you tell me how to display the data from a table by matching a protion of the field data using WHERE. e.g I want to see all rows of a table "Employee" having a column "name" (25 Char) whose 2nd 3rd and 4th char matches with say "abc". What I have to do for replacing those character with "xyz" in the table. Also intimate how to generate new Index for a table whose data (rows) are not in sequential order as that of the table from where the data is imported (from another server).  

  • You can find those with

    update ...

    set myfield=left(myfield,1)+'xyz'+right(myfield,len(myfield)-4)

    where myfield like '_abc%'

    %Any string of zero or more characters.WHERE title LIKE '%computer%' finds all book titles with the word 'computer' anywhere in the book title.
    _ (underscore)Any single character.WHERE au_fname LIKE '_ean' finds all four-letter first names that end with ean (Dean, Sean, and so on).
    [ ]Any single character within the specified range ([a-f]) or set ([abcdef]).WHERE au_lname LIKE '[C-P]arsen' finds author last names ending with arsen and beginning with any single character between C and P, for example Carsen, Larsen, Karsen, and so on.
    [^]Any single character not within the specified range ([^a-f]) or set ([^abcdef]).WHERE au_lname LIKE 'de[^l]%' all author last names beginning with de and where the following letter is not l.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply