0

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.

5
  • there is no a function in sql server to do this? :( Commented Dec 6, 2012 at 22:09
  • 1
    Why do it in SQL? Wouldn't your development framework be a better place? Commented 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 client Commented 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).aspx Commented Dec 6, 2012 at 22:11
  • stackoverflow.com/questions/10858646/… Commented Dec 6, 2012 at 22:11

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

Try using ASCII ( character_expression )

http://msdn.microsoft.com/en-us/library/ms177545.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.