Questions tagged [cfquery]

`` is the primary method of executing database queries and query-of-queries (QoQ) in ColdFusion/CFML.

<cfquery> is the primary method of executing database queries and query-of-queries (QoQ) in ColdFusion/CFML. The <cfquery> tag's more common attributes include:

  • name - The name by which the query will be referred in code.
  • datasource - The data source against which the query is to be executed. Conflicts with dbtype.
  • dbtype - Used with a value of query for query-of-queries (QoQ) and with a value of hql for ORM. Conflicts with datasource.
  • cachedwithin - The time span for which the query results should be cached. Note: ColdFusion caches queries according to the name and text of the query; if either changes, the query will not be cached.
  • maxrows - The maximum number of rows to be returned from the query. Use -1 to return all rows. Note: This does not affect caching (see cachedwithin above); if maxrows is changed on a cached query, the query will still return the number of rows returned when it was first cached.
  • timeout - The number of seconds ColdFusion should wait before timing out the query. If <cfsetting requesttimeout="*xxx*" /> is used, will override that value if the timeout specified for the query is used.

Also see:

(Please see the tag's documentation for additional attributes and their explanation.)

246 questions
3
votes
1 answer

How can I get one result from Table2 for each item in Table1 using CFQUERY?

I’m trying to do a query simliar to: SELECT * FROM Units, Tenants WHERE Units.UnitID=Tenants.UnitID #UnitName# #TenantID#
This is what the results…
Will Kelty
  • 41
  • 1
3
votes
1 answer

Send query to CFWheels selectTag form helper, or list with commas in string elements

I have a query that returns names in , format such as SELECT instructor_DBID, last_name + ', ' + first_name as instructor_name, hid …
abalter
  • 9,663
  • 17
  • 90
  • 145
3
votes
2 answers

ColdFusion Query-of-Queries Wildcard LIKE condition not working with single quotes?

I have a query-of-queries that performs a LIKE condition on a variable string: When the variable contains a single word that includes a single quote, some results are returned, but not all:
Eric Belair
  • 10,574
  • 13
  • 75
  • 116
3
votes
1 answer

cfquery not returning results when mulitple cfqueryparam are used

The following cfquery is failing in ColdFusion when the multiple cfqueryparams are used; however, when they are not used or only limited to one or the other the query returns the expected results:
rjzii
  • 14,236
  • 12
  • 79
  • 119
3
votes
1 answer

ColdFusion Query attribute repetition

I'm developing a basic ColdFusion application for a class and cannot control the CFAdmin. I was wondering if there was a way to avoid the repetition of the attributes datasource, username and password in each one of my queries, since they're always…
Angry Goomba
  • 474
  • 4
  • 20
3
votes
1 answer

embedding cfswitch in cfquery

Ok so we're trying to be clever by having database tables with defined fields like: (1) id, name, title, datemodified, dateadded and then extending them for various "objects" like Contact table (2) id, name, title, datemodified, dateadded,…
Jarede
  • 3,310
  • 4
  • 44
  • 68
3
votes
5 answers

How to access a scope if its name is being used as a query column

Dealing with some legacy code we came across a rather annoying situation. We are looping through a query with the tag. That query has a column named 'url'. Within that loop we need to check if a key exists within the url scope.…
invertedSpear
  • 10,864
  • 5
  • 39
  • 77
3
votes
1 answer

Does really blockfactor with cfquery enhances the performance in MS SQL server?

I am having a table having 360369 no of rows. I am using SQL SERVER. Today when i tried a simple select statement with cfquery and blockfactor,I did not find any performance enhancement. Moreover the performance reduced. Without blockfactor , the…
Deepak Kumar Padhy
  • 4,128
  • 6
  • 43
  • 79
3
votes
2 answers

How can I escape commas inside cfparam VARCHAR lists generated with ValueList?

Let's say there is a SQL table Fruit id | name --- ------ 1 | 'apples' 2 | 'pears' 3 | 'kiwi' 4 | 'bananas, peaches and plumbs' Given the following queries SELECT name FROM…
Daniel Mendel
  • 9,862
  • 1
  • 24
  • 37
3
votes
2 answers

how can I use AngularJS and a serializeJSON cfquery

I am trying to take a look at AngularJS, with a cf backend I have the following code that pulls a regular cfquery called getIndex which pulls five rows of columns each (firstName, lastName) var theQuery =…
Lance
  • 3,193
  • 2
  • 32
  • 49
3
votes
2 answers

CF QoQ is throwing runtime error. "Column reference is not a column in any of the tables of the FROM table list."

In my code, I first create the Query Object: I can then verify…
Dan
  • 3,246
  • 1
  • 32
  • 52
2
votes
1 answer

Creating a stored procedure in MySQL5 with ColdFusion 9's -Tag

I wonder if it's possible to create a stored procedure in MySQL5 via ColdFusion's -tag. I've never done anything with storedprocedures before... I was trying to set a function which replaces like MySQL's REPLACE but case insensitive. I…
Seybsen
  • 14,989
  • 4
  • 40
  • 73
2
votes
1 answer

how to print/display cfquery with cfqueryparam values replaced?

As you may be aware that when we dump cfquery, it dumps the cfqueryparam values into SQLPARAMETERS of the dump. It's been alright to replace a couple of parameters manually. However, lately I've started working on a project where there are tens(or…
akashb
  • 111
  • 6
2
votes
3 answers

ColdFusion - Is there a way to pull query details from prod database in dev environment?

I want a copy down of order details and related tables from prod to dev and I wanted to know whether we can query the details of prod server from dev environment using ColdFusion cfquery or queryExecute?
Chaitu
  • 29
  • 5
2
votes
2 answers

With Many-To-Many Relationship

I am working on a project for our accounting department. I have a database (MySQL) table with ledger codes. Our company has a few different office locations, and each of these codes can apply to one or more office location. Each office location…