Subject | Selecting records based on a list of ids (sp parameter) |
---|---|
Author | Rafael Szuminski |
Post date | 2004-04-06T17:30:58Z |
Hi,
Question:
What is the preferred way to pass a variable list of record IDs to a stored
procedure and then return records that are based on the list?
I have tried the usual suspects: Select IN (:list_of_ids) etc. :-)
Here is some background on the issue and perhaps there is a better design solution:
We are trying to port an mssql db to firebird. The overall port is simple but
for one thing: we have a master/detail level relationship between databases and
tables in those databases (I know it’s a bad thing, but there are multiple
business requirements that mandate this design, or better put it’s the lesser of
the evils). Anyhow, since FB can’t do cross-database joins, we figured we will
have our client app query the master database for a list of Ids and then pass
that list to the second database as a string or something similar and basically
get the recordset that way.
So, is there a better way to do this? If not, how can this be done?
Thanks in advance
Raf
Question:
What is the preferred way to pass a variable list of record IDs to a stored
procedure and then return records that are based on the list?
I have tried the usual suspects: Select IN (:list_of_ids) etc. :-)
Here is some background on the issue and perhaps there is a better design solution:
We are trying to port an mssql db to firebird. The overall port is simple but
for one thing: we have a master/detail level relationship between databases and
tables in those databases (I know it’s a bad thing, but there are multiple
business requirements that mandate this design, or better put it’s the lesser of
the evils). Anyhow, since FB can’t do cross-database joins, we figured we will
have our client app query the master database for a list of Ids and then pass
that list to the second database as a string or something similar and basically
get the recordset that way.
So, is there a better way to do this? If not, how can this be done?
Thanks in advance
Raf