EasyCFM.COM ColdFusion Forums / ColdFusion Applications / problem with simple query

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: problem with simple query

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

confusion
12-03-2007 @ 5:46 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 3
Joined: Dec 2007

Hello...

I'm brand new here, so please be gentle with me.

I started using Coldfusion back in the Allaire days and built a number of applications with CF 4.5. Years later and now I've built another site that is working fine locally for me, but with a simple query such as -

"SELECT * FROM content WHERE area = 98 AND column = 1 ORDER BY rank"

and I am getting this error -

Error Occurred While Processing Request  
Error Executing Database Query.  
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '='.  
  
The error occurred in E:\wwwroot\test\_mymag.cfm: line 22
Called from E:\wwwroot\test\mymag.cfm: line 40
Called from E:\wwwroot\test\_mymag.cfm: line 22
Called from E:\wwwroot\test\mymag.cfm: line 40

20 :      SELECT * FROM content where area = 98
21 : </cfquery>
22 : <CFQUERY NAME="getLeftCols" DATASOURCE="#APPLICATION.dsn#">
23 : SELECT * FROM content
24 : WHERE area = 98 AND column = 1


--------------------------------------------------------------------------------

SQL    SELECT * FROM content WHERE area = 98 AND column = 1 ORDER BY rank
DATASOURCE   taahbcf
VENDORERRORCODE   102
SQLSTATE   HY000

The host is using CF MX 7 with MSSQL Server 2005 and saying that "the JDBC connectors are not 100%".

I'd really appreciate any guidance that will sort this out. Thanks...


waynobweno
12-03-2007 @ 5:51 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 77
Joined: Oct 2007

I would try:

WHERE area = '98' AND column = '1'

just for kicks and giggle to see if it works...  

Real Estate CPR
www.realestatecpr.com
Demo: www.realestatecpr.com/demo/
Content=Presentation=Results!!!

CJ
12-03-2007 @ 9:29 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4262
Joined: Oct 2002

column is a reserved word in SQL Server.

if you can't rename it, enclose it in square brackets.

SELECT *
FROM
     content
WHERE
     area = 98 AND
     [column] = 1
ORDER BY rank

-CJ-
@ #coldfusion/DALNet
http://charlie.griefer.com

Teachers open the door. You enter by yourself.
—Chinese Proverb

confusion
12-04-2007 @ 8:05 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 3
Joined: Dec 2007

Many thanks, Charlie...

... you are a scholar and a gentleman. It is always the simple things, isn't it?

I have to admit, I am simple.

Much appreciated- that is working now. I get the feeling I will be back the next time I do something stupid. Until then, enjoy the sunshine and the work as Stone Cold Steve Austin's Stunt Double in San Ramon...

Hasta la vista...



This message was edited by confusion on 12-4-07 @ 8:06 AM

confusion
12-04-2007 @ 8:12 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 3
Joined: Dec 2007

case closed.

book 'em, Danno....


Website Designed and Developed by Pablo Varando.