Discussion:
List param
(too old to reply)
BrianV
2008-04-20 00:25:01 UTC
Permalink
I'm using a TSQLQuery, and am trying to do a statement such as:

delete from mapping_table where foreign_key_1 = :FK1 and foreign_key_2 in
(<list>)

Where <list> is a list of ID's selectable by the user. I'd love to pass
this as a parameter, but that doesn't seem to work. When I do so, I get an
error "<list> is not a valid integer value". The list can have a variable
number of items in it. I know that I can do this by just building up the
SQL statement as a string, but it seems there should be a better way.
Anybody know of one?
Bill Todd [TeamB]
2008-04-20 01:45:39 UTC
Permalink
Post by BrianV
delete from mapping_table where foreign_key_1 = :FK1 and
foreign_key_2 in (<list>)
Where <list> is a list of ID's selectable by the user. I'd love to
pass this as a parameter, but that doesn't seem to work. When I do
That is not the way parameters work in SQL. You will find that this
does not work with any SQL database.
Post by BrianV
so, I get an error "<list> is not a valid integer value". The list
can have a variable number of items in it. I know that I can do this
by just building up the SQL statement as a string, but it seems there
should be a better way. Anybody know of one?
Building the SQL statement dynamically is the solution.
--
Bill Todd (TeamB)
BrianV
2008-04-20 11:28:29 UTC
Permalink
Post by Bill Todd [TeamB]
Building the SQL statement dynamically is the solution.
OK, thanks.

Loading...