如何在SQL Server中使用“不同表"选择并插入一个查询? [英] How to select and insert in one query using Different Tables in sql server?
本文介绍了如何在SQL Server中使用“不同表"选择并插入一个查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用sql server中的不同表"选择并插入一个查询?
How to select and insert in one query using Different Tables in sql server?
推荐答案
这是您要尝试执行的操作吗?
Is this what you are attempting to do?
INSERT INTO [Records].[dbo].[ARCHIVE]
SELECT * FROM [Records].[dbo].[CURRENT]
尝试使用T-SQL块,请看
Try to use T-SQL blocks, have look here. see example G.
最后,我使用了下面的语句.
Finally i used the below Statement.. It is working well..
INSERT INTO InsCarriers_Copy
( InsCarrierId,
InsCarrierName,
ShortDescription,
ContactPhoneNo,
Location,
PhoneExt,
Fax,
Address1,
Address2,
ZipCode,
City,
State,
IsActive
)
SELECT InsCarrierId,
InsCarrierName,
ShortDescription,
ContactPhoneNo,
Location,
PhoneExt,
Fax,
Address1,
Address2,
ZipCode,
City,
[State],
IsActive
FROM InsCarriers
这篇关于如何在SQL Server中使用“不同表"选择并插入一个查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文