如何在Insert Sql语句中动态传递列和值。? [英] How Can I Pass Columns And Values Dynamically In Insert Sql Statement.?
本文介绍了如何在Insert Sql语句中动态传递列和值。?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在SQL插入语句中动态传递列和值。根据某些条件,列和值会有所不同。
注意:我只想使用一个SQL插入语句。
我想在StoredProcedur中将Array作为参数传递。
示例:
INSERT INTO table_name(column1,column2,column3,...)VALUES(value1,value2,value3,...)
我想在StoredProcedure中将列和值作为数组传递。
Hi,
I want to pass columns and values dynamically in the SQL Insert Statement.Means the columns and values will varies based on some condition.
Note: I want to use only one SQL Insert Statement.
I want to pass Array as Parameter in StoredProcedur.
Example:
INSERT INTO table_name (column1,column2,column3,...) VALUES (value1,value2,value3,...)
I want to pass columns and values as array in StoredProcedure.
推荐答案
很简单,你必须创建临时表并将它们发送到您的存储过程。
尝试阅读:
http://aspalliance.com/1891_Pass_Tables_to_Stored_Procedure__Table_Valued_Parameter.2 [ ^ ]
这是一个很好的例子;)
It is easy, you have to create temporary tables and send them into you stored procedure.
Try to read this:
http://aspalliance.com/1891_Pass_Tables_to_Stored_Procedure__Table_Valued_Parameter.2[^]
It is a good example ;)
这篇关于如何在Insert Sql语句中动态传递列和值。?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文