How do I pass a table-valued parameter to SQL Server 2008 via EntLib 5.0?
Asked
Active
Viewed 1,234 times
8
-
very interested to hear if/how it is possible. – TarasB Dec 18 '10 at 19:23
2 Answers
0
Good Luck... http://msdn.microsoft.com/en-us/library/bb675163.aspx quote:
Limitations of Table-Valued Parameters
There are several limitations to table-valued parameters:
You cannot pass table-valued parameters to CLR user-defined functions. Table-valued parameters can only be indexed to support UNIQUE or PRIMARY KEY constraints. SQL Server does not maintain statistics on table-valued parameters. Table-valued parameters are read-only in Transact-SQL code. You cannot update the column values in the rows of a table-valued parameter and you cannot insert or delete rows. To modify the data that is passed to a stored procedure or parameterized statement in table-valued parameter, you must insert the data into a temporary table or into a table variable. You cannot use ALTER TABLE statements to modify the design of table-valued parameters.

Predrag Djukic
- 103
- 5

phil soady
- 11,043
- 5
- 50
- 95
0
I haven't tried to do this but having had a quick look at the EntLib Data block I can't see an easy way of achieving this. You can do it with the SqlClient object, but EntLib doesn't support the Structured datatype that you need to pass the data in as a TVP.
If you are guaranteed never to need anything other than an SQL Server backend then I suppose you could cast your connection to a SQLServer-specific one and then use SqlParameters, but that would be defeating the purpose of using the EntLib somewhat.

Rikalous
- 4,514
- 1
- 40
- 52
-
Thanks for the input. I didn't see an obvious way, either, so I just did it using ADO.NET. That's not so bad. :) – birdus Dec 20 '10 at 07:40
-
It's not supported right now, as it's a Sql 2008 only feature, and we didn't get a lot of customer requests to add it. – Chris Tavares Dec 23 '10 at 04:48