How to pass Table-Valued Parameters (Array-like Parameter) to Stored Procedure in Microsoft SQL Server 2008 R2 using Microsoft SQL Server 2008 R2 JDBC Driver ? Is it possible with jTDS?
相关问题
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
相关文章
- Java的JDBC可以返回HashMap吗?
- Entity Framework 4.3.1 failing to create (/open) a
- Code for inserting data into SQL Server database u
- SQL Server 2008 Change Data Capture, who made the
- Get the connected mysql database name (JDBC)
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
The current (3.0) Microsoft driver doesn't support passing TVPs.
At one point, Microsoft was soliciting votes for TVP vs. Bulk Copy:
http://blogs.msdn.com/b/jdbcteam/archive/2011/09/22/tvp-or-bulk-copy.aspx
TVP got more votes, but it remains to be seen what actually got done. The most recent CTP for version 4.0 doesn't appear to have TVP support.
While this question was about SQL Server 2008, and while it really wasn't possible to pass table valued parameters at the time, it is now. This is documented here in the JDBC driver manual. For example, it could be done like this:
I've also recently blogged about this here.
I have solved this problem by myself. I have created CLR .Net Stored Proc with accepts a BLOB parameter. This BLOB is just a list of serialized INTs. It is possible to deserialize it using T-SQL or .Net CLR SP. .Net CLR SP has better performance, which was really important for my project.