如何将数组作为参数传递 [英] how to pass array as parameter

查看:114
本文介绍了如何将数组作为参数传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生,

我想知道如何将数组作为参数传递给MS-SQL SERVER 2008中的存储过程.

Dear sir,

I wonted to know how to pass array as a parameter to stored procedure in MS-SQL SERVER 2008.

推荐答案

您好,Pankaj此链接可能对您有所帮助
http://support.microsoft.com/kb/555266 [
Hi Pankaj this link may help you
http://support.microsoft.com/kb/555266[^]


您可以使用逗号分隔的值字符串,并将其传递给过程作为VARCHAR(MAX),则可以使用可以从此处复制的函数进行拆分:
http://blog.codelab.co.nz /2009/07/29/split-function-for-t-sql-using-xml/ [ http://blogs.microsoft.co. il/blogs/itai/archive/2009/02/01/t-sql-split-function.aspx [ http://www.sommarskog.se/arrays-in-sql.html [ ^ ]

希望对您有所帮助.
You can make a string of comma separated values and pass it to the procedure as VARCHAR(MAX) then you can split it with a function which can be copied from here :
http://blog.codelab.co.nz/2009/07/29/split-function-for-t-sql-using-xml/[^]
or here :
http://blogs.microsoft.co.il/blogs/itai/archive/2009/02/01/t-sql-split-function.aspx[^]

And also there are table valued parameters.

For more info read articles on this page :
http://www.sommarskog.se/arrays-in-sql.html[^]

Hope it helps.


这篇关于如何将数组作为参数传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆