SQLTeam.com | Weblogs | Forums

What does this REPLACE function do?

I'm looking at someone's code that I need to better understand.

Replace(Column1, Column2, ' ')
Does it add a space between the 2 pieces of data? What is ' ' doing?


Replacing all strings in Column1 that match the string in Column2 with a single space. You might not want to use an empty string, '', because you need the space as a delimiter.

I sometimes write it this way just to be clearer:

Replace(Column1, Column2, SPACE(1))

1 Like