cfquery

How to read columns with spaces from coldfusion queries?

五迷三道 提交于 2019-12-02 07:40:09
问题 I am reading data from a spreadsheet. One of the column in the spreadsheet contains spaces. For Example, Columns names are [first name,last name,roll]. I am getting a qryObj after reading the spreadsheet. Now when i am trying to read first name from the query <cfquery dbtype="query" name="getName"> SELECT [first name] FROM qryObj </cfquery> It is throwing db error. I have tried with ['first name'] also but still it is throwing error. The error is: Query Of Queries syntax error. Encountered "[

How to read columns with spaces from coldfusion queries?

荒凉一梦 提交于 2019-12-02 06:18:53
I am reading data from a spreadsheet. One of the column in the spreadsheet contains spaces. For Example, Columns names are [first name,last name,roll]. I am getting a qryObj after reading the spreadsheet. Now when i am trying to read first name from the query <cfquery dbtype="query" name="getName"> SELECT [first name] FROM qryObj </cfquery> It is throwing db error. I have tried with ['first name'] also but still it is throwing error. The error is: Query Of Queries syntax error. Encountered "[. Incorrect Select List, Incorrect select column I did crazy stuff like googling to see what people had

define a list of id's for grouped item

南笙酒味 提交于 2019-12-02 04:27:52
i got a little question, i just can't understand, what is the problem and how do i solve it, i have a coldfusion variable, for example #account_code# , first of all, this code looks like this: 100.001.001 (there are bunch of them of cource) and i have some values for this variable, like sum(nettotal) and the cfquery i grouped by this #account_code# , all i want is to set the list of these codes, thus i define list, for example <cfset code_list='100.001.001,100.001.002'> and in query: account_code in (#code_list#) i also tried this one account_code in ('#code_list#') but instead it gives out

Using cachedwithin attibute inside cfquery

牧云@^-^@ 提交于 2019-12-01 18:16:43
When you use the cachedwithin attribute in a cfquery how does it store the query in memory. Does it store it by only the name you assign to the query? For example, if on my index page I cache a query for an hour and name it getPeople will a query with the same name on a different page (or the same page for that matter) use the cached results or does it use some better logic to decide if it is the same query? Also, if there is a variable in your query does the cache take into account the value of the variable? It's not only the name -- it's the exact query you're running. <cfquery name=

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

本秂侑毒 提交于 2019-12-01 08:57:49
Dealing with some legacy code we came across a rather annoying situation. We are looping through a query with the <cfoutput query="x"> tag. That query has a column named 'url'. Within that loop we need to check if a key exists within the url scope. Since CF puts a priority on what's in the query over general page scopes I can't use a structKeyExists(url,"key") since as far as CF is concerned at this point, url is a string with the value from the current row of the query. How can I break out of the query scope and inspect what's in my url? As a temporary we are using isDefined("url.key"), but I

How to Execute 2 or more insert statements using CFQuery in coldfusion?

牧云@^-^@ 提交于 2019-12-01 05:37:41
Is it possible to Execute 2 insert or Update Statements using cfquery ? If yes how? if no, what is the best way to execute multiple queries in Coldfusion, by opening only one Connection to DB. I think every time we call cfquery we are opening new connection DB Within the data source settings you can tell it whether to keep connections open or not with the Maintain Connections setting. Starting with, I believe, ColdFusion 8 datasources are set up to run only one query at a time due to concerns with SQL injection. To change this you would need to modify with the connection string. Your best bet

cfquery crashes when there are tsql comments

落爺英雄遲暮 提交于 2019-12-01 03:57:09
This does not crash in ColdFusion 11, but does crash in ColdFusion 2016 SELECT * FROM dbo.Roles WITH (NOLOCK) WHERE Code IS NOT NULL AND Active = 1 AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK)) -- It's ok to look at termed employees This works OK in both SELECT * FROM dbo.Roles WITH (NOLOCK) WHERE Code IS NOT NULL AND Active = 1 AND RoleID IN (SELECT RoleID FROM dbo.Emp WITH (NOLOCK)) Is there a setting to restore the orginal behavior? UPDATE I thought I had a minimal example of the issue, but I didn't. Here is the complete query SELECT '<ul>' + STUFF ( ( SELECT MIN(Role) AS "li

How to Execute 2 or more insert statements using CFQuery in coldfusion?

妖精的绣舞 提交于 2019-12-01 03:19:03
问题 Is it possible to Execute 2 insert or Update Statements using cfquery ? If yes how? if no, what is the best way to execute multiple queries in Coldfusion, by opening only one Connection to DB. I think every time we call cfquery we are opening new connection DB 回答1: Within the data source settings you can tell it whether to keep connections open or not with the Maintain Connections setting. Starting with, I believe, ColdFusion 8 datasources are set up to run only one query at a time due to

How to override SQL sanitization in ColdFusion

落花浮王杯 提交于 2019-11-30 14:52:58
I have the unfortunate task of cleaning up a bunch of old ColdFusion code. Queries are all over the place, I am working on moving them all to common CFCs for easier maintenance. I am running into a problem because cfquery is automatically converting the single quotes to double-single-quotes. How can I override that behavior? More specific information is below. So here is the query I started with: <cfquery name="getObjectInfo" datasource="#BaseDS#"> SELECT groupName AS lastname, '[Group]' AS firstname FROM groups WHERE groups.group_id = #objectreference_id# </cfquery> The weird thing here is

Retrieving long text (CLOB) using CFQuery

核能气质少年 提交于 2019-11-29 14:16:03
I am using CFQuery to retrieve the CLOB field from Oracle DB. If the CLOB filed contains the Data less than ~ 8000, then I can see <CFQuery > retrieved the value ( <cfdump> the o/p), however If the value in CLOB field size is more than 8000 chars, then its not retrieving the value. in <cfdump> i can see the query retrieved as 'empty String' though the value exists in Oracle DB. I am using the Oracle Driver in CFadim console, enabled 'Enable long text retrieval (CLOB).' and 'Enable binary large object retrieval (BLOB). ' Set 'Long Text Buffer (chr)' and 'Blob Buffer(bytes) ' values to 6400000