Update/replace

  • What is the best way to update a column within a table which has the following type of data (5000 records in table):

    http://www.myprofile.co.uk/

    http://www.myprofile.co.uk/

     

     

    I need to take the slant on the end off ONLY. Replace statement removes all slant when I really only want to take the slant on the end off.

  • update t
    set col = substring(t.col,1,len(t.col)-1)
    from table t
    where t.col like '%/' --if not all records are affected

    You might want to consider taking the "http://" off (or adding it on) where applicable. All the values in a column should contain exactly the same type of information. You would need to ensure all new values in the column conform to the desired format.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • Thanks, that worked a treat.

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

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