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
2
votes
4 answers

How to print all the result without using Results.columnname in ColdFusion

How to print all the result without using Results.columnname in ColdFusion for ex:- I have select productId from product In Product Table i have 2 columns with product_name and…
CFUser
  • 2,295
  • 5
  • 32
  • 37
2
votes
1 answer

Mix raw queries and ORM operations within the same cftransaction

Is it safe to mix raw queries using cfquery and ORM operations within the same cftransaction tag? ...
plalx
  • 42,889
  • 6
  • 74
  • 90
2
votes
2 answers

CF Query appears to return incomplete data from text field

I'm using CF8 and SQL2000. I'm storing a bunch of HTML in a Text field in my SQL table. When I do a simple CFQUERY against that data, and CFDUMP it, it's truncated to 64000 characters. I've confirmed that my data is complete in the SQL table, by…
user154499
2
votes
3 answers

How do I use cfqueryparam in ORDER BY to list titles matching "School of " first

How do I use cfqueryparam in the ORDER BY to have titles matching "School of " listed first and then just list the rest of the titles? Here is my current query: SELECT title,…
Alpdog14
  • 129
  • 2
  • 14
2
votes
2 answers

Is it possible to have dynamically generated query names in ColdFusion?

What I am trying to do is
John
  • 13,197
  • 7
  • 51
  • 101
2
votes
4 answers

In ColdFusion 8, is there a way to see the SQL inside a failing cfquery?

I have a which generates some SQL inside. It's failing, but I have no idea why. I tried wrapping it inside a block, and dumping the result. However, result is undefined. Is there another way to see what the SQL looks…
PBG
  • 8,944
  • 7
  • 34
  • 48
2
votes
4 answers

ColdFusion - approach for table of query data and CRUD actions

My question is more geared towards approach than it is programming or errors. I have a query that runs and gathers a set of data. I then want to use that query's return values to build a table on a page listing all the values. Along with that I…
bcar
  • 815
  • 9
  • 19
2
votes
1 answer

cfqueryparam with uniqueidentifier type in table

I have a query where I am attempting to insert values into a table and one of these values (ImportID) is of type uniqueidentifier in the database. I have looked in the adobe CF documentation and saw that both cf_sql_char and cf_sql_idstamp should…
1
vote
1 answer

Why is MySQL looking for colum with name of value inserting

When doing a cfquery to MySQL, MYSQL gives me the error Unknown column 'Question' in 'field list' on the following code: INSERT INTO ETrueFalseQuestions VALUES…
Computerman1597
  • 214
  • 3
  • 10
1
vote
1 answer

querying a result of cfquery or filtering cfquery

I have two tables of data categories and category relations. This is a setup to allow infinite levels of parent/child relationships. I could put it into a linked list too I guess, but this might allow one child to have multiple parents if the need…
Daniel
  • 34,125
  • 17
  • 102
  • 150
1
vote
2 answers

SQL Server FIRST function via JDBC

I am building an application in cold fusion which has a SQL Server database connection. I need group records and only return the first in the group. I wrote the following query in coldfusion. SELECT FIRST(ID) FROM table GROUP BY NAME Which is…
Kenneth J
  • 4,846
  • 11
  • 39
  • 56
1
vote
1 answer

Cannot find syntax error in Coldfusion query

I do not understand why I am getting this error. I am using a cfform to send data from one html page to the next. See below. Another thing I am noticing is that the first two characters of the angle_changes string are cut off. It should be…
1
vote
2 answers

Using ColdFusion query, find number of SQL occurrences of a varchar 'headline' but show only one instance of that headline

This CF query does what I want but I'd like to show only one occurrence of each matching "HEADLINE" that has a count greater than 5. I don't need to display the actual count, just the headline which will be a link using that headline as a url…
1
vote
1 answer

cfqueryparam pass in list from input checkbox

I have a input checkbox field where user can select multiple checkboxes in a form, and depending on what they select, it will create a string of id's like 10,14,35,47, and that will be submitted to the database. I can get this submitted if I just…
Joel
  • 41
  • 1
  • 5
1
vote
0 answers

How to display only the selected row after clicking edit button?

Below is the code on my edit page. I want it to show only the data that I have clicked the edit button on. I click on one row only but then it shows all of the data. Can anyone see what's wrong with the code? I guess there must be some condition on…
zedd-coder
  • 11
  • 2