SQL中的插入问题 [英] insertion problem in sql

查看:78
本文介绍了SQL中的插入问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个SQL表,其中一个col是Material(INT).

现在,我的任务是我想将一系列材料放入ListBox,然后选择其中一些材料,然后将其插入到我的表格中.


例如:

varchar ---''a,b,c,d''---插入了为什么bcz用单引号我们
传递了N个值,表示将其视为单个
参数.

类似地

int --- 1,2,3,4 ---只需要一次插入到我的表中即可.

谁能帮我做到这一点..

在此先感谢...

Hi,

I have a SQL Table , in that one of the col is Material (INT).

Now, My task is i want to take a list of materials into ListBox, and then i select some of them, and then insert in to my table is it possible.


for ex:

varchar --- ''a,b,c,d'' --- its inserted why bcz with in the single quotation we
are passing N no.of values means it''s consider as a single
parameter.

similarly

int --- 1,2,3,4 --- has to be inserted into my table in a single insertion only.

can any one help me to do this..

Thanks in advance...

推荐答案

您真的要在一行中的一列中插入多个值吗?然后,您决定进行一个非常糟糕的设计:阅读有关规范化"的信息!
最好为每行的列使用一个值,并使用事务"来确保所有值都已插入(如果失败则不插入).
Do you really want to insert multiple values into one column in one single row? Then you decided for a very bad design: read about "normalization"!
Better use one value for the column per row, and use a "transaction" to make sure that all values are inserted (or none in case of failure).


这篇关于SQL中的插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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