I have a table with two columns, one is for storing characters to be replaced and other with the replacement character.

Let rows of my table(each column is separated with '|') are

1. \r\n\r\n | \r\n
2. \r\n | \n

How can I write a stored procedure which accepts string as parameter and replace the characters of the string with these column values.
(Like if a string which contains \r\n then it must be replaced by \n)

I have tried the Cursor method and executed the procedure with the string:-

```
EXEC DBO.SP_REPLACE 'Hello!\r\nThis is for the testing of\r\n\r\nString
replacement\r\nwith characters\r\n\r\nand special characters\r\n'

```

The resuting string :-

```
Hello!\nThis is for the testing of\nString replacement\nwith 
characters\nand special characters\n

```

Actually I wanted to replace 'FIRST OCCURANCE' with a replacement. Once the replacement is done further replacement of the replaced string should be avoided .

So the final expected o/p be like-

```
Hello!\nThis is for the testing of\r\nString replacement\nwith 
characters\r\nand special characters\n

```