Table valued parameters in SQL Server 2008


In this article I will demonstrate how we can ultilise the new feature called table valued parameters in SQL Server 2008. These are great addition to the SQL sever 2008 that allows us to pass multiple rows of data to the stored procedure. In earlier versions we acheived this functionality by  converting the data into XML or calling the stored procedure mulitple times or by many different means. Lets see how this new feature works in SQL server 2008.

 

tvp

Basically what we have done here is as follows:

1.Created a table called Mobiles

2.Created a new type called MobileTable

3. Created a new stored procedure which accepts a parameter of type MobileTable and inserts records into the Mobiles table.

4.Executed the stored procedure

This  new feature will be a great benefit for the SQL server developers and client side developers working on ASP.NET or any other client interface where they can send the whole bunch of tables as parameters to the stored procedures without converting them into XML or any other client side modifications.  I hope this article helps you…

Advertisements
This entry was posted in SQL Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s