insert into dbo.OffEmployeeRecord
select * from dbo.EmployeeRecord where Code=1
此代码将数据从table_1
复制到table_2
,但我想在单个查询中移动它(从第一个表复制后删除)
答案 0 :(得分:0)
您可以编写存储过程来执行此类操作
createProc [dbo].[ProcRemoveEmoRecord]
(
@CodId varchar(50)
)
As
begin
insert into dbo.OffEmployeeRecord
select * from dbo.EmployeeRecord where Code=@CodId
delete from dbo.EmployeeRecord where Code=@CodId
end
创建上述sp后,您可以通过执行上述过程
执行所需的操作