使用存储过程在单个语句中插入多行 [英] insert multiple row in a single statement using store procedure

查看:81
本文介绍了使用存储过程在单个语句中插入多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串变量,字符串变量中的值是

string query = values('Aloo','fry','54',1,5)('DalTadka',' fry','34',1,5)



i希望使用存储过程在表中插入这些字符串值。

i have a string variable and values in the string variable are
string query=values('Aloo','fry','54',1,5)('DalTadka','fry','34',1,5)

i want to insert these string values in a table using store procedure.

推荐答案

您可以使用@Ashish_Agrawal发布的此查询插入多个记录
You can insert multiple records using this query posted by @Ashish_Agrawal


以下是一次向表中插入多行的SQL查询。



Following is the sql query to insert multiple rows to a table at a time.

Insert INTO Table1(Col1, Col2, Col3)
Values('a','b','c'),
     ('x','y','z')





您可以将其包装到存储过程中,并可以通过逗号分隔为参数传递多行值。



You can wrap it into a stored procedure and can pass multiple rows values by comma separated as a parameter.


查看这篇文章

多种方式进行多次插入 [ ^ ]


这篇关于使用存储过程在单个语句中插入多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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