Is it possible to create a SQL In statement using variables?
For example, here is what can be done:
SELECT Test.ID, Test.Desc
FROM Test
WHERE (((Test.ID) In (3,6,9,12)));
But, I would like to do something like this:
SELECT Test.ID, Test.Desc
FROM Test
WHERE (((Test.ID) In ([@TestTypes])));
( I have a loop that will be passing the: 3,6,9,12 )
However, it does not work. Am I missing something in the syntax or is
it I cannot do it this way?
Any thoughts and or advice is greatly appreciated.
Ray 1 2199
You can pass a single parameter easiely - check help for details.
However, for your example it might make more sense to build the sql
statement as a text string and then execute it. Have your loop build
the IN statement and concatenate the parts as required.
Tim Mills-Groninger
On Jun 24, 10:34*am, bcap <r...@patriots.comwrote:
Is it possible to create a SQL In statement using variables?
For example, here is what can be done:
SELECT Test.ID, Test.Desc
FROM Test
WHERE (((Test.ID) In (3,6,9,12)));
But, I would like to do something like this:
SELECT Test.ID, Test.Desc
FROM Test
WHERE (((Test.ID) In ([@TestTypes])));
( I have a loop that will be passing the: 3,6,9,12 )
However, it does not work. *Am I missing something in the syntax or is
it I cannot do it this way?
Any thoughts and or advice is greatly appreciated.
Ray
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: David Hitillambeau |
last post by:
Hi guys,
As I am new to Python, i was wondering how to declare and use global
variables. Suppose i have the following structure in the same module (same
file):
def foo:
<instructions>...
|
by: Daniel Roy |
last post by:
Hi gurus,
I just started to look at a very slow-running SQL statement
generated by an application (Siebel). I spooled the SQL from the
application, replaced the bind variables by their values, and...
|
by: Alvin Bruney |
last post by:
Is a switch more efficient than an if statement? I observe thru the debugger
that a switch statement jumps directly to its case handler where as an if
statement examines all conditions...
|
by: Sunny |
last post by:
Hi,
I can not understend completely the lock statement.
Actally what is locked:
1. the part of the code between {...}
or
2. the object in lock()
In the docs is written:
for 1: The lock...
|
by: Thierry Loiseau |
last post by:
Hello all,
and Happy end year 2005 !
Well, I would like to obtain a list of all JavaScript var statement,
With "for...in" perharps ?
That is bellow my recent test here, but the problem is...
|
by: eman1000 |
last post by:
I was recently looking at the prototype library
(http://prototype.conio.net/) and I noticed the author used the
following syntax:
Object.extend(MyObj.prototype, {
my_meth1: function(){},...
|
by: reycri |
last post by:
While the following is allowed:
if (a == b)
SomeFunction();
else
OtherFunction();
The following is not:
try
|
by: microsoft.public.dotnet.languages.vb |
last post by:
Hi All,
I wanted to know whether this is possible to use multiple variables to
use in the select case statement such as follows:
select case dWarrExpDateMonth, dRetailDateMonth
case...
|
by: gool |
last post by:
Hi,
I am writing this piece of code:
$sqlquery="WITH journey (TO_TOWN, STEPS, DISTANCE, WAY)
AS
(SELECT DISTINCT JNY_FROM_TOWN, 0, 0, CAST('PARIS' AS VARCHAR(MAX))
FROM T_JOURNEY
...
|
by: franc sutherland |
last post by:
Hello,
I am using Access 2003.
Is it possible to use string variables in the INSERT INTO statement?
I am using the INSERT INTO statement to add a long list of contacts to
a group by looping...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |