Home > Database > Mysql Tutorial > 复制本地数据库中的一个表到远程数据库

复制本地数据库中的一个表到远程数据库

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:17:41
Original
1989 people have browsed it

首先将要复制的表导入到远程数据,假设本地表名为hw2, 在数据库也有一个名为hw的结构相同的表,已经有了20000条数据。 导入成功后,会新增一个表hw2, 运行以下语句,会复制一个表hw3 select * into hw3 from dbo.hw2 运行以下语句,新增记录若干条: insert

首先将要复制的表导入到远程数据,假设本地表名为hw2, 在数据库也有一个名为hw的结构相同的表,,已经有了20000条数据。

导入成功后,会新增一个表hw2,

运行以下语句,会复制一个表hw3

select * into hw3 from dbo.hw2

运行以下语句,新增记录若干条:

insert into hw (sort3_id,sort2_id,sort_id,hw_name,hw_cash,hw_danwei,hw_content,hw_date,isbn,hw_oldcash,admintuijian,tejia,hw_kucun,ZRXS,hw_name2,hw_oldcash2,baozhuang,baozhuang2,guige,wail,waiw,waih,zhuangxiang,neihe,chushoutype,hw_content2,hw_danwei2,tuijianzhishu,pifa,factory_code,pro_code,cqzl,cqmz,tjxs,pp,beizhu,hits)
select sort3_id,sort2_id,sort_id,hw_name,hw_cash,hw_danwei,hw_content,hw_date,isbn,hw_oldcash,admintuijian,tejia,hw_kucun,ZRXS,hw_name2,hw_oldcash2,baozhuang,baozhuang2,guige,wail,waiw,waih,zhuangxiang,neihe,chushoutype,hw_content2,hw_danwei2,tuijianzhishu,pifa,factory_code,pro_code,cqzl,cqmz,tjxs,pp,beizhu,hits from hw2


注意:上面的字段不能有----自动增长列,否则会出错:
“仅当使用了列的列表,并且 IDENTITY_INSERT 为 ON 时,才能在表 'hw' 中为标识列指定显式值。”
 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template