Help Sql Query needed

  • Task 1

    Example: THE GOLDEN CLINIC

    THE RIGHT ONE

    BAUSCH AND LOMB (A)

    -I need to move word 'THE' from the beginning and put it in the end with a , infront of 'The'

    -I need to change the word 'AND' to '&'

    Final result : GOLDEN CLINIC, THE

    RIGHT ONE, THE

    BAUSCH & LOMB-A

    Task 2

    Example: FOX'S PIZZA DEN - PARKHILL

    BORDERS- STORE #074

    POL/MELVIN, JOAN ORIE

    -I need to remove ' and -

    -I need to remove - and #

    -I need to remove /

    Final result: FOXS PIZZA DEN PARKHILL

    BORDERS STORE 074

    POL MELVIN JOAN ORIE

    Please Help, Thanks

  • Task 2: Use REPLACE. Look it up in Books On Line.

    Task 1: Find all records that begin with 'THE '. Play with RIGHT() to strip it off.

    use update query to remove it from the front of the string and append it to the end.

    That should be help enough. There's a difference between helping and doing your job for you. =)

  • pietlinden (2/26/2015)


    Task 1: Find all records that begin with 'THE '. Play with RIGHT() to strip it off.

    use update query to remove it from the front of the string and append it to the end.

    Replace will work for this also. Basically, remove it and add it to the end.

    REPLACE(Field, 'THE ', '') + ' , THE'

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

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

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