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
1
vote
1 answer

Filter system in ColdFusion 8

I have been working on a small simple project on localhost for a client, it's a comment system with a filter. But whenever I try to add the filter, it seems to get stuck on it's first word. I've been trying to search the answer on Google for almost…
D3VNL
  • 11
  • 2
1
vote
2 answers

getting an extra OR before the search

I have this query and i m am getting an extra OR after the AND clause and the search is failing SELECT id,name,email,useris,roleid FROM users WHERE 1=1 …
indy
  • 33
  • 3
1
vote
3 answers

Filtering cfquery results

I am editing already existing code, which is why this question is formed as it is. I am attempting to use a query that already exists and without adding more form variables through the url. So my problem: I have a query that is being run, and this…
SomeoneRandom
  • 264
  • 1
  • 7
  • 19
1
vote
1 answer

How to loop through a SQL query and output individual emails base on

I'm trying to loop over information from a query and send that information in an email. Currently, based on my stored procedure, I'm displaying all the rows in the email. This is what I'm using to get the above information: …
Millhorn
  • 2,953
  • 7
  • 39
  • 77
1
vote
2 answers

ColdFusion - Output Grouping From a Query

I have a great question that is probably bone-head simple. I have the following query: SELECT firstname,lastname,deptname,supcode FROM getreviews WHERE supcode IN…
1
vote
1 answer

count total records for each user

I have this code that pulls all users with open requests. I need to show a total for each assigned buyer. SELECT * FROM allorders3 WHERE open = 'y' order by…
carlosl
  • 11
  • 1
1
vote
2 answers

How to combine two arrays into a usable cfquery, or similar solution?

I have two arrays being passed as form variables from a report page to a print page. These arrays are built as the user goes through the report, and checks checkboxes. I need to do a query based on the two arrays. One array contains numbers, the…
1
vote
1 answer

Colfusion Query results based on query results from a related table

I am querying a table for all the available records. The results have a primary key called ticket_id SELECT * FROM service_ticket where technician_id != AND…
Brian Fleishman
  • 1,237
  • 3
  • 21
  • 43
1
vote
3 answers

Query null values

I have the column deletedTime in my instances table. Now I want to check in ColdFusion if the value is null. There is only one record to be printed out with the query. IsNull(test) is returning the correct value, but…
dewey
  • 809
  • 2
  • 16
  • 47
1
vote
1 answer

How to output query value only once?

I have query that returns four columns. One of the columns can have the same value for multiple records. I would like to output that value only once. Here is example of the data: Rec ID Name Color Year 45 Nick Green 2018 34 Mike …
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
1
vote
3 answers

Check if any field is different from database value

After I submit a form, I need to check if any field in the database table changed. If changed I create a new record, if not, I don't do anything. I can't just update the record. Is there a way to do it without checking every single field like the…
myTest532 myTest532
  • 2,091
  • 3
  • 35
  • 78
1
vote
4 answers

Coldfusion 8 - cfquery insert statement times out

I'm building a script that uses cfhttp to reads a delimited log files. These log files tend be rather large so when I try to INSERT the data from the logfile into a table I've created, my cfquery insert statement times out. So, my idea to get…
Robbiegod
  • 954
  • 4
  • 14
  • 44
1
vote
1 answer

ColdFusion function returns an error "The system has attempted to use an undefined value"?

I have function that should save some form fields. This function is able to process multiple insert rows. So far I was able to create logic to handle this but the only issue so far I have once user tries to save the record. The server response looks…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
1
vote
1 answer

queryEach or .each() not Working at CF 11, Why?

I was seaching in google better form to interate over "query" in coldfusion, since im new in the company im working, and im trying to get more from CF Here my attempts: My models:
Diego Vinícius
  • 2,125
  • 1
  • 12
  • 23
1
vote
5 answers

Should I use "maxrows" in my query? ColdFusion / SQL

Is it necessary to use maxrows="1" when searching for a row with a numeric primary key? select * from table where RowID = #NumericVariable# Does ColdFusion have some kind of SQL binding or anything else…
Evik James
  • 10,335
  • 18
  • 71
  • 122