Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL Server
Expertise: Beginner
Jul 8, 1999

Passing Text Fields

Question:
I need to pass large fields of text. Problem is, some of the text has single quotes in it ( ' ). How do I pass these text fields to SQL without getting an error?

For example:

sqlText = "EXEC sp_NewEntry '" &  thisText & "', '" & thatText & "', '" & moreText & "', '"
I need to wrap all of the text in single quotes to SQL, but if any of the text contains single quotes, it burps an error. What's the syntax to pass the text correctly?

Answer:
I thought I saw a solution for this while I was in training, where they used square brackets and "`" as a delimiter, which was a new one on me. I'm not certain, but I think the thing to do is to use double single quotes ('') to mark the included quote mark.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date