I’m finding that there are several points in the stored procedures that I’m creating where I want a stored procedure to accept a list of IDs in various tables that the SP should perform an operation on. I’m considering using Table Value Parameters. What I’m wondering about is whether it’s a good practice to create a single Type which just contains a single “ID int” column, and use that as the data type for all of my TVP’s, or whether it’s a better practice to define a type for each SP, in case I end up in the future wanting to expand the values passed.
Does anyone have experience with this?
edit In case it makes any difference to your recommendation, the ID lists that I’m passing may be on the order of 150,000 entries.
What I can offer you in the way of experience is that if you find you need to change the definition of a user defined table type, you will need to drop every reference to the type before you can diddle with it. Down in the Cons section mentioned that great annoyance. So for us, it was worth the code maintenance to define unique table types based on expected usage, even if it matched existing types. YMMV