1Cougar
asked on
Getting text from table with single and double quotes
Hello,
I would like to create a function that will be passed in quite a lot of text and which will replace any single and/or double quotes with the html value for them. I have tried the code below but I get an error in compiling it....
I am not sure what I am doing wrong. Any help would be much appreciated.
Cheers,
I would like to create a function that will be passed in quite a lot of text and which will replace any single and/or double quotes with the html value for them. I have tried the code below but I get an error in compiling it....
I am not sure what I am doing wrong. Any help would be much appreciated.
Cheers,
DECLARE @X nvarchar(100)
DECLARE @MyText nvarchar(100)
SET @MyText = 'he's not "very" good'
SET @X = REPLACE(@MyText,'"','"')
SET @X = REPLACE(@X,'''''',''')
PRINT @X
ASKER
Hello and thank you....but the text in the database (entered by a user) has only single quote. I want to retrieve this text but I need to change the single quote to '''
?
Thanks again,
?
Thanks again,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
replace(replace(mytext,cha r(34),'&qu ot;'),char (39),'' ')
Open in new window