I want to SELECT data for an undefined number of PK values.
I could create a SP that takes 1 PK parameter and performs a simple select (SELECT * FROM MyTable WHERE Id=@Id), and just call that SP as many times as I have @Id parameters.
Is there a way I can construct my SP to accept an array/collection of @Id parameters so that I only have to make one call to the database. I guess I could create a byte array in the app and then pass the byte array as a varbinnary parameter and the loop through the varbinnary parameter in the SP, but that doesn't sound too clean and I would probably prefer calling the simple SP several times over that.
Any thoughts on this would be welcome.
Thanks,
Einar
Semper ubi sub ubi.