• It shows up like that because I didn't code format it in my post - i did type in two spaces. I am just trying to explain to you why REPLACE can't work in the manner you thought it was going to, and the reason is that if you wanted to replace an expression with another expression that contained the first expression, then it would never terminate.

    I'm not saying your function has those issues - when I was saying 'I realised why it can't...' I was talking about the REPLACE built in function, not your one. Sorry, I wasn't clear on that.

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone