I have a single quote in a column name, and I want to translate it to ', is there any function to translate a character into a html code?
Thank you.
-
there is no a function in sql server to do this? :(rgx71– rgx712012-12-06 22:09:01 +00:00Commented Dec 6, 2012 at 22:09
-
1Why do it in SQL? Wouldn't your development framework be a better place?Bennor McCarthy– Bennor McCarthy2012-12-06 22:09:06 +00:00Commented Dec 6, 2012 at 22:09
-
is crazy I know, but I would like to retrieve it already from sql and push it into the clientrgx71– rgx712012-12-06 22:10:31 +00:00Commented Dec 6, 2012 at 22:10
-
@rgx71 No, there is no native function in SQL server to do this. You will have to write your own user defined function. Here are some native string manipulation methods which may be helpful: msdn.microsoft.com/en-us/library/ms181984(v=sql.105).aspxEsoteric Screen Name– Esoteric Screen Name2012-12-06 22:11:07 +00:00Commented Dec 6, 2012 at 22:11
-
stackoverflow.com/questions/10858646/…RichardTheKiwi– RichardTheKiwi2012-12-06 22:11:53 +00:00Commented Dec 6, 2012 at 22:11
Add a comment
|
2 Answers
You can achieve it with REPLACE, but you'll have to replace every entity manually.
SELECT REPLACE(YourColumn, '''', ''') FROM YourTable
But as I said in the comments, SQL isn't really the right tool for the job.
Comments
Try using ASCII ( character_expression )