如何在SqL中创建具有无限和未定义参数的存储过程? [英] How can i create a stored procedure which has unlimited and undefined parameter in SqL?
本文介绍了如何在SqL中创建具有无限和未定义参数的存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨开发者..我是sql server的新手请帮帮我。我想创建存储过程将值插入表中它很简单但是如何才能使用单个存储过程插入不同的2值不同的时间。
它的意思是我想创建存储过程,其中包含无限和未定义的参数,如c#中的params []参数。
请帮帮我
Thanx !!
Hi developers ..I am new in sql server please help me.I want to create stored procedure for insert values into a table it is simple but how can it possible to use single stored procedure for inserting different-2 value different time.
Its mean i want to create stored procedure which has unlimited and undefined parameter like params[] argument in c#.
Please help me
Thanx!!
推荐答案
SQL没有数组的概念,所以它不能接受无限的参数 - 如果是没有内置的最大参数计数限制。
解决此问题的一种方法是使用CSV参数,并使用此处的函数:在SQL IN子句中使用逗号分隔值参数字符串 [ ^ ]将它们转换为内部表格。
SQL has no concept of arrays, so it can't accept "unlimited" parameters - eve n if it didn't have a maximum parameter count limit built in.
One way to get round this is to use a CSV parameter, and use the function here: Using comma separated value parameter strings in SQL IN clauses[^]to convert them to a table internally.
也许我可能是错的,但你不能使用XML作为参数并用它来存储无限参数吗?
Hi,
Perhaps i may be wrong, but can you not use XML as a parameter and use it to store infinite parameter?
你好。
你不能用无限的参数计数来做程序因为参数的数量限制在2100.
欲了解更多信息,请参阅此链接:
http://technet.microsoft.com/ru-ru/library/ms187926.aspx [ ^ ]
考虑在过程中使用xml或表类型作为参数。 />
有关表格类型的更多信息,请点击以下链接:
在SQL中传递表值参数rver 2008 [ ^ ]
Hello.
You cannot do procedure with unlimited parameters count because the number of parameters are limited to 2100.
For more information please refer this link:
http://technet.microsoft.com/ru-ru/library/ms187926.aspx[^]
Consider to use xml or table types in your procedure as parameters.
For more information about table types please follow this link:
Passing table valued parameters in SQL Server 2008[^]
这篇关于如何在SqL中创建具有无限和未定义参数的存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文