HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Is there an upper limit to the SqlDbType.Structured ADO.NET type?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thelimitadotypeuppernetstructuredsqldbtypethere

Problem

Is there an upper limit to the number of rows\total size of the SqlDbType.Structured type when sending data to a Table parameter in a sproc?

I can't find anything to suggest there is so I'm assuming that there'd just be a time-out if a giant data set was sent.

I'm looking at 2000-ish rows, so nothing frightening. I just want to preempt any potential explosions.

Solution

There is no inherent limit to the size of a table-valued parameter. However, you could run into client memory constraints if you pass the value without streaming, such as using a DataTable or IEnumerable (without a stream source implementation) instead of a DataReader.

On the server side, the limit is tempdb storage.

2K rows won't be a problem as I've passed millions of rows without issues. One consideration, though, is to be sure to specify the MaxLength for string columns with a DataTable value. See my blog post SQL Server TVP Performance Gotchas.

Context

StackExchange Database Administrators Q#183271, answer score: 5

Revisions (0)

No revisions yet.