使用后端中另一个的详细信息更新表 [英] Update a table with the details of another in the backend
问题描述
亲爱的期待,
需要在ms sql server的后端更新包含另一个字段内容的表2008.
使用新的查询工具
2个表格如下。
要更新的表格是:
Table_Update.dbo
1. Idno
2.姓名
3. Update_Amount
数据来源的表是
Table_From
1. Idno
2.名称
3 。来自_Amount
请为我提供在后端执行上述操作的例行程序
谢谢
我尝试过:
检查互联网但找不到样本
Dear Expect,
Need to update a table with the fields content from another in the back-end in ms sql server 2008.
Using New Query tool
The 2 tables are as follows.
The table to be updated is :
Table_Update.dbo
1. Idno
2. Name
3. Update_Amount
The table from which the data is coming from is
Table_From
1. Idno
2. Name
3. From_Amount
Please provide me with a routine to carry out the above in the backend
Thanks
What I have tried:
Checked the internet but couldn't find a sample
推荐答案
试试这个 - 请参阅UPDATE查询低价
Try this - See the UPDATE query below
CREATE TABLE DstTbl (Idno INT,Name NVARCHAR(50),Update_Amount INT)
CREATE TABLE SrcTbl (Idno INT,Name NVARCHAR(50),Update_Amount INT)
INSERT INTO SrcTbl
SELECT 1,'AB',100
INSERT INTO DstTbl
SELECT 1,'',null
UPDATE DstTbl SET Name=s.Name, Update_Amount =s.Update_Amount
FROM SrcTbl s INNER JOIN DstTbl d on s.Idno=d.Idno
select * from DstTbl
这篇关于使用后端中另一个的详细信息更新表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!