SQL Query Help!

Posted on 2003-03-21
Medium Priority
Last Modified: 2013-12-24
I am not sure why, but I am getting an error with the following code:

<cfset test = "FName = 'DAN'">

<cfquery name="GetUsers" datasource="#dsn#">
 FROM Leads
 WHERE #Test#

And i get:
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 3: Incorrect syntax near 'DAN'.

Question by:SilverG
LVL 15

Accepted Solution

danrosenthal earned 120 total points
ID: 8185001

<cfset test = "FName = 'DAN'">

<cfquery name="GetUsers" datasource="#dsn#">
FROM Leads
WHERE #preservesinglequotes(Test)#

Author Comment

ID: 8185101
You sir, are the man!


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question