使用多个查询插入表中 [英] insert into table using multiple query

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

问题描述

我想在一个有3列的桌子上添加数据

前两个coulumn我必须从另一个表中添加数据我做了

bt for third column i想在我的应用程序中插入文本框中的值



希望你们都明白我的问题

提前知道

解决方案

您应该为该表中的两列组合创建唯一键

并使用这两个值,您可以使用更新 [ ^ ]声明。


 创建 < span class =code-keyword> Procedure  Proc_Demo 
@ Val VARCHAR 50
A S
BEGIN
插入 进入表1(Value1,Value2,Value3)
选择 V1,V2, @Val 来自表2)

END







推荐此代码,它将帮助你


亲爱的朋友......我喜欢smthng



插入[学习]。[dbo]。[QAtbl](SID,Sname,Ques,Subject)SELECT [SID],[Sname] ],'+ s7 +','+ s6 +'FROM [Learn]。[dbo]。[StdDetail]其中Username ='+ s3 +';



,S7和S6是我的应用文本框...



thnks frnds ..

i want to add data on one table having 3 column
for first two coulumn i have to add data from antother table tht i did
bt for third column i want to insert value from textbox on my application

hope u all understand my problem
thnks in advance

解决方案

You should create unique key for the combinations two columns in that table
and using those two values you can update the third column of that particular row using Update[^] statement.


CREATE Procedure Proc_Demo
@Val VARCHAR(50)
AS
BEGIN
Insert Into Table1 (Value1,Value2,Value3)
(Select V1,V2,@Val  From Table2)

END




Referer this code it will help ou


Dear frnds...i do smthng like

"insert into [learn].[dbo].[QAtbl](SID,Sname,Ques,Subject) SELECT [SID] ,[Sname],'"+s7+"','"+s6+"' FROM [Learn].[dbo].[StdDetail] where Username='"+s3+"'";

in that S7 and S6 are my text box in apllication...

thnks frnds...


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

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