| Subject: | Re: MS SQL - Syntax error for valid query |
|---|---|
| From: | Ian Skinner <iskinner@xxxxxxxxxxx> |
| Date: | Tue, 29 Jan 2008 07:50:23 -0800 |
| Newsgroups: | macromedia.coldfusion.database_access |
AWFrueh1808 wrote: Thinking about this some more...I know what preservesinglequotes does - it retains single quotes in a variable by keeping them from being parsed by CF. I don't think you have quite the right handle on preserveSingleQuotes(). It's only purpose is for use in SQL statements. Let's look at a literal example. INSERT INTO aTable (aField) 'Let's go to the park at 10 o'clock, can't we?'This statement would fail because of the single quotes in the data one needs to preserve these by escaping them. INSERT INTO aTable (aField) 'Let''s go to the park at 10 o''clock, can''t we?'This is the default behavior for variables inside of a SQL statement. CF will escape single quotes under the assumption that you want them inserted into the database as data. <CFSET text = "Let's go to the park at 10 o'clock, can't we?"> INSERT INTO aTable (aField) #text#The preserveSingleQuotes() function is the switch when one does NOT want the single quotes escaped inside of a SQL statement. |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | query a search query, cybertek23 |
|---|---|
| Next by Date: | Re: MS SQL - Syntax error for valid query, AWFrueh1808 |
| Previous by Thread: | Re: MS SQL - Syntax error for valid query, AWFrueh1808 |
| Next by Thread: | Re: MS SQL - Syntax error for valid query, AWFrueh1808 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |