Click here to Skip to main content
15,887,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The use off TVP's has it's advantages, in terms of doing the equivalent of huge bulk-inserts to a database.

A bit of background...

In a scenario where you may have to insert, say 20,000 records into a database, rather than doing 20,000 individual inserts, you can pass a complex objec, a DataTable directly to SQL Server 2008, as a parameter in part of your SPROC call.

For example if you need to associate those 20,000 records with a specific ID, the SPROC signature would look something like:


CREATE PROCEDURE [dbo].[InsertItemsTVP] @EntryID BIGINT, @ItemTVP TVP_Items READONLY

This way, you can associate the one ID with all those 20,000 entries.

Now, there are several posts detailing how to use TVP's with C# and other .Net technologies. However, my comment is regarding the use of SubSonic in generating your DAL, which does not have support for TVP's.

I have re-written the SubSonic DAL framework to now recognize TVP's and am curious about the level of interest me writing an article with code for this.
Posted
Updated 26-Nov-10 4:27am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900