How to replace a comma with space in SQL

Posted on the September 25th, 2008 under SQL by admin

Background

I came across this issue when dumping the contents of a table into a CSV file from Enterprise Manager. Many people put comma’s into fields when typing their own address or something similar. This means when the CSV is opened many rows of data will be erroneous. So the solution is to replace any comma with a space so the contents of that field are still readable.

Solution

Replace(table.field, ‘,’, ‘ ‘)

*Replace the “table.field” with the applicable table name and field name

This simple bit of code fixes the comma issue and will allow the table to be dumped into a CSV for further manipulation.

So that’s how to replace a comma with a space in SQL

Share this Solution:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Google Bookmarks
  • Facebook
  • Live
  • Sphinn
  • Furl

Leave a Reply
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>