开发者

How to pass a 2D array to a Stored procedure?

I'm trying to pass a 2D array from by C#.NET p开发者_运维问答rogram to a stored procedure in SQL Server 2005. I dont know how to accomplish this. I'm gathering my data in a DataGridView.

Can anyone help me with this?


SQL Server doesn't support arrays as such.

Depending on how much data you have, you can do something like this: How to Pass and Handle a Delimited String similar to handling an Array() of Values.

You can also read Erland Sommarskog's article on the subject of Arrays and Lists in SQL Server 2005 which outlines various different approaches to tackling the problem.


At SqlServerCentral there's an excellent article by Jeff Moden on how to split a CSV list in Sql server. The tally table approach is also shown in the article by Erland Sommarskog, but this one seems to use slightly different concepts. So it might be worth comparing performance of the two.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜