Question

I have a stored procedure that accepts a table-valued parameter.

I am passing a Datatable from my C# DAL. Are TVPs guaranteed to retain the order of rows when invoking the stored proc. My guess is that it should be (in which case this is a dumb question to ask). But I just want to be dead-sure about it.

Thanks

Vikas

Était-ce utile?

La solution

Order should be preserved.

From MSDN:

Table-valued parameters offer more flexibility and in some cases better performance than temporary tables or other ways to pass a list of parameters. Table-valued parameters offer the following benefits:

  • Do not acquire locks for the initial population of data from a client.
  • Provide a simple programming model.
  • Enable you to include complex business logic in a single routine.
  • Reduce round trips to the server.
  • Can have a table structure of different cardinality.
  • Are strongly typed.
  • Enable the client to specify sort order and unique keys.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top