I have a column of type Nvarchar(max) in the database of the SQL server, and now I want to replace any characters of the word in the string. The string is as follows:
DECLARE @Description NVARCHAR(MAX)
SET @Description = 'This is text with far too much xx char xanthic Mix Excise xerox Ox Maximize'
Select @Description, REPLACE(@Description,"x", "how replace x with AAA MMM ZZZ")
If x is in the middle of the word in the string, replace it three times with MMM. If x appears at the beginning of a word in the string, replace it three times with AAA. If x is at the end of the word in the string, replace it three times with ZZZ.
I want the output string to be like that.
This is teMMMt with far too much AAAZZZ char AAAanthic miZZZ eMMMcise AAAeroZZZ oZZZ maMMMimise
How to obtain the desired output result?
1