Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing array/collection of PK parameters
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Passing array/collection of PK parameters
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01258747
Message ID:
01258747
Vues:
64
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform