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 the error, it says the Incorrect syntax near '.001'. as far as i understand i need to replace somehow these dots, and define the codes id's without them. thank you all for the help! i really appretiate it!
相关问题
- How to specify argument attributes in CFscript? (C
- Coldfusion date conversion: “2013-11-15T06:11:57.8
- ColdFusion Java Method Not Found Exception
- Coldfusion - How to parse and segment out data fro
- ColdFusion XLS “Export” and Character Encoding
相关文章
- How do I prevent SQL injection with ColdFusion
- How to scope closure's variables in CF10?
- What Notable Differences are there between Railo,
- Restarting ColdFusion mail queue
- How to pass additional data to restful API Basic a
- ColdFusion: Application Options Based on Role?
- Best algorithm to Encrypting / Decrypting a string
- Creating a Google reCAPTCHA 'secure token'
If i understand your question is really how do you correctly use the SQL IN clause.
The SQL IN clause takes a list of values, if those values are numeric they do not need to be quoted, but your codes are strings, so each value needs to be quoted
In ColdFusion the correct way to do this is the use <cfqueryparam> with list=true
This turns your list into multiple parameters in your query, and if your code_list is actually being passed in by a form or url variable helps to protect you from SQL injection attacks.