Question: Use file content as input for queries
I need to run some complex queries with `where` conditions. The elements in the `where` condition vary in length, from some dozens to thousands.
Each time I need to run those queries, I manually edit them to match the new where conditions, copying and pasting from text files where I have a list of values, but this process is tiresome and slow.
Is there a way to pass a list of values extracted from a file to a query?
I know you can use parameters, but as far as I have seen, you can only pass one value, not many.
I would like something like `select * from table where id in ($filename.txt)`, where filename.txt contains a list of values.
Or, if there is a better way to do what I usually do, I will be glad to learn it.
Thanks in advance
Please sign in to leave a comment.
@Cesarslzr
> I know you can use parameters, but as far as I have seen, you can only pass one value, not many.
Make sure you've enabled user parameters support in settings:
and provided proper parameter syntax in a query:
---
As for reading values from file, could you specify database engine you use?