Hello I am working on a query where I am trying to SELECT a record using the IN() function: - <cfquery name="getAddresses" datasource="#application.datasource#">
-
SELECT ID, COMP_NAME, ADDRESS1_1, CITY1, STATE1, ZIP1, PHONE1_1, FAX1_1, CATEGORY
-
FROM Vendors
-
WHERE #id# IN (CATEGORY)
-
ORDER BY COMP_NAME
-
</cfquery>
id is a cfparam passed in on the url and CATEGORY is a varchar.
I am getting the following error:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Syntax error converting the varchar value '1,2,9' to a column of data type int.
Any help would be appreciated, I have tried everything!
3 1312
Hello I am working on a query where I am trying to SELECT a record using the IN() function: - <cfquery name="getAddresses" datasource="#application.datasource#">
-
SELECT ID, COMP_NAME, ADDRESS1_1, CITY1, STATE1, ZIP1, PHONE1_1, FAX1_1, CATEGORY
-
FROM Vendors
-
WHERE #id# IN (CATEGORY)
-
ORDER BY COMP_NAME
-
</cfquery>
id is a cfparam passed in on the url and CATEGORY is a varchar.
I am getting the following error:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Syntax error converting the varchar value '1,2,9' to a column of data type int.
Any help would be appreciated, I have tried everything!
In() function should also contain select query
like -
SELECT ID, COMP_NAME, ADDRESS1_1, CITY1, STATE1, ZIP1, PHONE1_1, FAX1_1, CATEGORY
-
FROM Vendors
-
WHERE #id# IN (Select Id_Category from CATEGORY)
-
ORDER BY COMP_NAME
Hello I am working on a query where I am trying to SELECT a record using the IN() function: - <cfquery name="getAddresses" datasource="#application.datasource#">
-
SELECT ID, COMP_NAME, ADDRESS1_1, CITY1, STATE1, ZIP1, PHONE1_1, FAX1_1, CATEGORY
-
FROM Vendors
-
WHERE #id# IN (CATEGORY)
-
ORDER BY COMP_NAME
-
</cfquery>
id is a cfparam passed in on the url and CATEGORY is a varchar.
I guess you're using ColdFusion? (the cf... and MacroMedia hint to that)
I don't have any experience or knowledge of CF, but #id# (probably an integer?) will never be part of a varchar field CATEGORY. The types just won't match.
And why check if the #id# is part of the CATEGORY field in the same record? Doesn't sound logical or useful to me...
Dont you mean
WHERE CATEGORY IN (#id#)
Hope that helps!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: xuatla |
last post by:
Hi,
I have the following code for function pointer. compiling is ok. Can you
help me to check whether it's a good way to implement as:
class CA
{
.....
private:
void f1( double ) ;
|
by: Rob |
last post by:
Hi everyone,
I'm having some big JS problems - my function is making my html code
vanish, and I need help!
Here's the code, try it for yourself. You'll notice that when you
click either links...
|
by: Craig Keightley |
last post by:
Please help, i have attached my page which worksin IE but i cannnot get the
drop down menu to fucntion in firefox. Any one have any ideas why?
Many Thanks
Craig
...
|
by: mikekimhome |
last post by:
I am trying to capture a whole function definition from a file. I have
read the contents of the file into a string variable and tried a regex
to extract the function definition. Good thing is I...
|
by: Stef Mientki |
last post by:
I'm making special versions of existing functions,
and now I want the help-text of the newly created function to exists of
1. an extra line from my new function
2. all the help text from the old...
|
by: yxq |
last post by:
Hello,
I want to get the string resource from DLL file, the code work well for
Vista x86, but it will not work on Vista x64, why? can anyone help to view
the code below? thank you very much.
...
|
by: Bob |
last post by:
Hi,
Hope you can help me with this one. I'm at my wits end. I'm trying to
create an intelligent edit-box like the
excellent "Customer" one at the URL:
...
|
by: Lacreme |
last post by:
My taxes do not want to calculate. I have tried sub precedures, functions, loops, select cases, and if/else structures. Im out of things to try. HELP....
Public Class Form1
Sub...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |