AnsweredAssumed Answered

How to read in a list of ints to be passed into sql

Question asked by maia zoggo on Sep 29, 2018
Latest reply on Oct 6, 2018 by Bill Moore

I'm a newbie. I need to load a list of ids ( integers ) from a file. I then need to pass these into sql. I can't work out how to do that because manipulating the list of int into a comma separated list leaves me with a string.

 

So I have an excel reader that reads in my ids. There will be ~10 ids.

I have a table input that my sql is in. e.g.
select all from table where id in ( ${myIds} )

which I want to expand to

select all from table where id in (123,234,345,456,567)

I've tried group by and set variable and so on but all leave me with the string problem. Its a sybase ase database if that helps.

I don't want to do a join because I'll have to pull out all the data from my table which will be millions of rows and then do an inner join to a max of around 10 ids so that will slow things down.

 

Any suggestions welcomed.

Outcomes