Ask a Question related to Coldfusion Database Access, Design and Development.
-
mikey999 #1
Query used to work
I have this one query it used to work in cfm 5.0 but now gives an error in cfm
6.0 <b>The query is</b> <CFQUERY NAME='ParentOrganization'
datasource='mydatasource'> SELECT Organizations.OrganizationName,
LinkAdv.LinkAdvID, LinkAdv.Custom1, LinkAdv.DateCreated,LinkAdv.configID FROM
LinkAdv INNER JOIN Organizations ON LinkAdv.OrgID = Organizations.OrgID WHERE
LinkAdv.LinkAdvID = #GetParentID.Custom13# AND LinkAdv.StatusID = 'Approved'
AND DesignatedPages NOT LIKE '%UNGREENBIZ%' AND (LinkAdv.configID = 14 or
LinkAdv.configID = 12) <CFIF #ConfigIDGooD# is '14'>AND LinkAdvID NOT IN
(#GetData.LinkAdvID#)</cfif> Order By Custom1 </CFQUERY> <b>I get this
error</b> error Error Executing Database Query. [Macromedia][SQLServer JDBC
Driver][SQLServer]Incorrect syntax near the keyword &apos;AND&apos;.
The error occurred in
D:\web\customers\greenbiz\includes\Refrence_OtherL inks.cfm: line 37 Called from
D:\web\customers\greenbiz\reference\events_record. cfm: line 222 Called from
D:\web\customers\greenbiz\includes\Refrence_OtherL inks.cfm: line 37 Called from
D:\web\customers\greenbiz\reference\events_record. cfm: line 222 35 : AND
(LinkAdv.configID = 14 36 : or LinkAdv.configID = 12) 37 : <CFIF
#ConfigIDGooD# is '14'>AND LinkAdvID NOT IN (#GetData.LinkAdvID#)</cfif> 38 :
Order By Custom1 39 : </CFQUERY>
--------------------------------------------------------------------------------
SQL SELECT Organizations.OrganizationName, LinkAdv.LinkAdvID,
LinkAdv.Custom1, LinkAdv.DateCreated,LinkAdv.configID FROM LinkAdv INNER JOIN
Organizations ON LinkAdv.OrgID = Organizations.OrgID WHERE LinkAdv.LinkAdvID =
AND LinkAdv.StatusID = 'Approved' AND DesignatedPages NOT LIKE '%UNGREENBIZ%'
AND (LinkAdv.configID = 14 or LinkAdv.configID = 12) Order By Custom1
DATASOURCE sunmaster_new VENDORERRORCODE 156 SQLSTATE HY000 The sql
looks right no??
mikey999 Guest
-
How does the query cache work?
Hi all, I'm experiencing a strange problem ( IMHO). query: SELECT SQL_CALC_FOUND_ROWS `a`.`id` AS `aanvraag_id`, `a`.`tijdstip`,... -
Query use to work on CF 4.5
I'm getting the following error "No value given for one or more required parameters." However this worked on CF 4.5 but not on CF 6.1. Any ideas? ... -
Query by date doesn't work
I'm using Informix 9.3, If I run the query in Informix it works, when I run the same query in ColdFusion I get a string to date conversion. I'm... -
Query dosen't work
hi friends i have a question i make this on application.cfm <cfapplication sessionmanagement="yes" name="UniqueName" ClientManagement="No"... -
SQL/ASP.NET getting DATE to work in query
I'm grabbing today's date with some ASP.net code: Dim Today As Date Today = Microsoft.VisualBasic.Today() I'm then trying to run a SQL query... -
paross1 #2
Re: Query used to work
I don't see anything wrong either, so you might troubleshoot by removing parts
of the query, like the CFIF part, to see if you can isolate the exact phrase
that is causing the error.
Also, you might consider replacing
AND (LinkAdv.configID = 14 or LinkAdv.configID = 12)
with
AND LinkAdv.configID IN (12, 14)
as it may be a little more efficient, and/or readable. (There really isn't
anything wrong with the way that you did it, though.)
Phil
paross1 Guest
-
The ScareCrow #3
Re: Query used to work
It should not make a difference, but try putting a space after each clause.
Sometimes if you have
Select ColumnFrom TableWhere Column = value
You will get an error, now the driver should do this (replace a space for the
CR) but maybe it's not.
Ken
The ScareCrow Guest
-
mikey999 #4
Re: Query used to work
I tried making the changes you two suggested but this did not fix this issue.
Here is the web site page the error is happening on in case this shines any
light on this
[url]http://www.greenbiz.com/reference/events_record.cfm?LinkAdvID=63234[/url]
mikey999 Guest
-
Tulsa #5
Re: Query used to work
My guess is that you need single quotes around the 12 and 14 in (LinkAdv.configID = 14
or LinkAdv.configID = 12)
Tulsa Guest
-
paross1 #6
Re: Query used to work
I visited your link and looked at the error message. You have a problem here:
LinkAdv.LinkAdvID = #GetParentID.Custom13# It looks to me like
#GetParentID.Custom13# is null or blank.
Attached is your query as it showed at the bottom of the error message. Notice
where it says WHERE LinkAdv.LinkAdvID = AND. Fix #GetParentID.Custom13# and
you will probably be OK.
Phil
SELECT Organizations.OrganizationName, LinkAdv.LinkAdvID, LinkAdv.Custom1,
LinkAdv.DateCreated,LinkAdv.configID FROM LinkAdv INNER JOIN Organizations ON
LinkAdv.OrgID = Organizations.OrgID WHERE LinkAdv.LinkAdvID = AND
LinkAdv.StatusID = 'Approved' AND DesignatedPages NOT LIKE '%UNGREENBIZ%' AND
LinkAdv.configID IN (12, 14) Order By Custom1
paross1 Guest



Reply With Quote

