This blog is intended for sharing an interesting difference I spotted between the functionality of REPLACE function in SQL 2008 & 2005 versions
Consider the following example
DECLARE @Test table
(
ID int identity(1,1),
Val char(10)
)
INSERT INTO @Test
SELECT ‘cat’ union all
select ‘test’ union all
select ‘hi’ union all
select ‘hello’
select REPLACE(Val,’ ‘,’.’)
FROM @Test
Run this in a SQL 2008 box and the result will be as follows