Table Value Parameters in SQL Server 2008 and .NET (C#).docx


文档分类:研究报告 | 页数:约4页 举报非法文档有奖
1/4
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/4
文档列表 文档介绍
Table Value Parameters in SQL Server 2008 and .NET (C#) Problem We recently upgraded our database to SQL Server 2008 and I want to update our data access C# code to use Table Value Parameters with our stored procedures . In a previous tip I saw that Table Value Parameters were used with a Data Warehousing example. Can you show me how to implement Table Value Parameters with my .NET Application to insert multiple records using one round-trip? Solution Table Value Parameters isa new feature for developers in SQL Server 2008 . It allows you to pass read-only table variables into a stored procedure . In the past I have used ma delimited string or XML to simulate this purpose. I would have to parse out the string into a temp table similar to this example . Once you have the table parameter passed into the stored procedure you can leverage the Table Value Parameter just like any other table except you cannot modify the parameter as it’s read-only. Below we will apply mon example to bulk insert data using one round trip. Create table and table type The following isa sample table that we will use in this example to insert items. CREATE TABLE [dbo].[Items]( [ItemID] [int] NOT NULL, [Name] [nvarchar](50) NULL, CONSTRAINT [PK_Items] PRIMARY KEY CLUSTERED ([ItemID] ASC ))ON[PRIMARY] In order to use table value parameters you have to create a table type. The table type is used to describe t

Table Value Parameters in SQL Server 2008 and .NET (C#) 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数4
  • 收藏数0 收藏
  • 顶次数0
  • 上传人aluyuw1
  • 文件大小0 KB
  • 时间2016-07-14