| Subject: | Re: MS SQL - Syntax error for valid query |
|---|---|
| From: | "paross1" <webforumsuser@xxxxxxxxxxxxxx> |
| Date: | Tue, 29 Jan 2008 16:27:59 +0000 (UTC) |
| Newsgroups: | macromedia.coldfusion.database_access |
Per the definition of the PreserveSingleQuotes() function: Description Prevents ColdFusion from automatically escaping single-quotation mark characters that are contained in a variable. ColdFusion does not evaluate the argument. Usage This function is useful in SQL statements to defer evaluation of a variable reference until runtime. This prevents errors that result from the evaluation of a single-quote or apostrophe data character (for example, "Joe's Diner") as a delimiter. Example B: Consider this code: <cfset list0 = " '1','2', '3' "> <cfquery sql = "select * from foo where bar in (#list0#)"> ColdFusion escapes the single-quote characters in the list as follows: ""1"", ""2"", ""3"" The cfquery tag throws an error. You code this function correctly as follows: <cfquery sql = "select * from foo where bar in (#preserveSingleQuotes(list0)#)"> This function ensures that ColdFusion evaluates the code as follows: '1', '2', '3' Phil |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: MS SQL - Syntax error for valid query, AWFrueh1808 |
|---|---|
| Next by Date: | Re: query a search query, paross1 |
| Previous by Thread: | Re: MS SQL - Syntax error for valid query, AWFrueh1808 |
| Next by Thread: | Re: MS SQL - Syntax error for valid query, Ian Skinner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |