Take in ' as a string in SQL Server

Results 1 to 4 of 4

Thread: Take in ' as a string in SQL Server

  1. #1
    Baby Gerl Guest

    Default Take in ' as a string in SQL Server

    Hi all,<BR><BR>I have this problem related to SQL Server. It seems that if a string contains an &#039; character it could go in the database.<BR>Since in SQL Server &#039; is actually a reserved character...eg when you need to hardcode a value in SQL server u actully used &#039;hello&#039; instead of "hello".<BR><BR>Any way to prevent that...? Any ideas.Pls advise.<BR>Appreciate it...:)

  2. #2
    Join Date
    Dec 1969

    Default ASPFAQs.com, FAQ # 27

    Check out this popular FAQ:<BR><BR>How do I get SQL to accept an apostrophe in various queries, such as when I try to add a user named "O&#039;Brien"?<BR>http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=27

  3. #3
    Baby Gerl Guest

    Default Thanks so much there's a little prob..

    Hi Scott,<BR><BR>Thanks so much for the solution...<BR>but there is a tiny winy prob...when trying to display back<BR>the value it only displat the value before the &#039;.<BR><BR>I wrote the value of the text box by -<BR><BR>Response.Write "Value=&#039;" & rsVal & "&#039;" <BR><BR>Any ideas? meanwhile I keep trying ...thanks a lot ya.

  4. #4
    Join Date
    Dec 1969

    Default RE: Take in ' as a string in SQL Server

    You can always write a script in VB or Jscript to remove the &#039; and replace it with ` the character under the tilde on your keyboard. You can find scripts that strip the character out at www.infiniteMonkeys.ws/infinitemonkeys.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts