SQL复制表

View Code
--创建test_employee_info临时表结构,不保留关联关系
select * into test_employee_info from employee_info where 1<>1;

declare @num int
set @num=1

while @num<6
begin
insert into test_employee_info select employee_code+'p'+cast(@num as varchar(1)),employee_name,department_code,entry_date,transfer_date,leaving_date,post,post_status,status,change_post_date,margin_total_amount,margin_settlement_date,margin_status,employee_margin_approve_id,updated_by,updated_date,create_by,create_date from employee_info
set @num=@num+1
end
go

--将临时表的数据导入到employee_info
insert into employee_info select * from test_employee_info;

--DROP临时表
drop table test_employee_info

posted on 2012-03-13 17:09  sumflower  阅读(160)  评论(0编辑  收藏  举报

导航