Print
Add To Favorites
Email To Friend
Rate This Article
|
Pass Tables to Stored Procedure / Table Valued Parameter
|
Published:
06 Nov 2009
|
Abstract
When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a SQLBulkCopy object available in .NET to send multiple rows of data to SQL Server at once, but this still cannot be passed to a stored procedure.
SQL Server 2008 provides a new feature called "Table-Valued Parameters". This provides us the ability to easily pass a table to a stored procedure from T-SQL code or from an application as a parameter. |
 |
by Aamod Thakur
Feedback
|
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days):
25122/
237
|
|
|
|
| Introduction |
When we have to pass multiple rows of data to SQL Server the
developers either have to send one row at a time or come up with other
workarounds to meet requirements like using XML datatype to pass data which is
a bit complex and tedious to use. Also there is a SQLBulkCopy object available
in .Net to send multiple rows of data to SQL Server at once, but the data still
can not be passed to a stored procedure.
|
|
|
|
|
Article Feedback
User Comments
Title:
ERROR
Name:
ERRUT
Date:
3/17/2012 2:06:27 AM
Comment:
I AM GETTING MANY ERRORS WHILE USING THIS CODE
|
Title:
Loosing time
Name:
Radu
Date:
11/7/2011 9:40:59 AM
Comment:
This article was a totaly waste of my time.
|
Title:
Disappointed
Name:
Ajai
Date:
7/12/2010 12:22:46 AM
Comment:
You never mentioned how to execute this stored proc from c# or Sql window itself.
|
Title:
Pass TVP in another sproc
Name:
ak
Date:
4/26/2010 2:40:45 PM
Comment:
How would i pass TVP to sproc#2 from inside sproc #1 exec @MyParameter MessageQueue READONLY is this correct?
|
Title:
Disaapointed
Name:
Ajay
Date:
4/13/2010 11:05:33 AM
Comment:
Good article but not what i am looking for
|
Title:
Good article
Name:
Chitta Ranjan Nayak
Date:
2/26/2010 9:40:36 AM
Comment:
Really a good article.
|
Title:
good article
Name:
manas sahu
Date:
12/23/2009 8:46:08 AM
Comment:
Good article but not what i m looking for.
|
Title:
Title misleading
Name:
Chin Kiat
Date:
12/8/2009 1:26:10 AM
Comment:
The title is not match to what you are posting...i understand why jeewan disaapointed =(
|
Title:
disappointed
Name:
jeewan
Date:
11/20/2009 5:48:05 AM
Comment:
Not what i am searching http://pictube1.blogspot.com/
|
|
|
|
|
|