Subject | Stored procedure with array parameters |
---|---|
Author | Robert martin |
Post date | 2007-07-23T22:41:56Z |
Hi
I need to create a SP that takes 1 or more numeric primary key values
and returns a result set consisting of data from all values passed. In
real terms 95% of the time only one value would be passed, however I
could see potentially say 5 being the max.
What would be the best way to deal with this?
Should I
A) Have 10 params (allowing up to 10 Pks) and set unused to null
B) pass in one string parameter that has comma seperated values. I like
this but am not sure of the syntax required to break then numbers out
(just using the std FB dlls)?
C) have a table that is loaded with the values (I dont want this)
D) Other options.
Ta
--
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
I need to create a SP that takes 1 or more numeric primary key values
and returns a result set consisting of data from all values passed. In
real terms 95% of the time only one value would be passed, however I
could see potentially say 5 being the max.
What would be the best way to deal with this?
Should I
A) Have 10 params (allowing up to 10 Pks) and set unused to null
B) pass in one string parameter that has comma seperated values. I like
this but am not sure of the syntax required to break then numbers out
(just using the std FB dlls)?
C) have a table that is loaded with the values (I dont want this)
D) Other options.
Ta
--
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd