归元

sql2005复制表

sql 2005表的复制有两种:一种就是把整个表复制过去,就好像复制文件并且重命名。别外一种就是把表的内容复制过出.
select * into newtable from oldtable;把oldtabel复制到newtable且newtable不存在,否则出错.;

insert into newtable select * from oldtable把oldtable的内容插入到newtable, newtable一定要存在,才可以复制.

不同数据库间复制表
if object_id('test') is not null drop synonym test
create synonym test for test.dbo.vdwl_product
select * into  vdwl_product from test
select * from vdwl_product

评论

© 归元 | Powered by LOFTER