Hi everyone,
I have a stored procedure which takes 2 integer parameters and returns either a 1 or a 0. It's quite long so I won't post it here unless you feel it's nessesary.
Currently I have a table named 'Books', a table named 'Filters'. Each row in 'Books' has a column named 'FilterId'. Basically what happens is that when a user visits the books page, the rows from the 'Books' table are retrieved from the server. I then have to loop though each row and call my stored procedure, passing in the user's id and the 'FilterId' from the book row. So I end up getting a 1 or a 0 for each book, which fyi is used to decide whether the user can view the book.
This works, but it seems like I could do it better and faster with a nested stored procedure (if thats possible). So what I want to do is call one stored procedure and just give it the user's ID. This procedure will then loop through each row of the 'Books' table and call my orginal stored procedure on that row. I then need some way to select only the rows that returned a 1 from my original stored procedure and that would be the result set.
Thanks for your help.