Replace

  • How can I run a replace function on all records in a table? For instance, if I wanted to loop through a phone number field in a table and replace all of the "-"'s with "", what's the easiest way to do this?

  • Have not tested this but try:

    update <yourtable>

    set phone = replace(phone,'-','')

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

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

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