Insert into SELECT statement [ry field can be copied]

Source: Internet
Author: User

The SQL Server built-in Import and Export function can export common attribute tables:

However, if the table you want to copy contains a geometry field, you cannot import a table with a geometry field if you use the built-in import/export table function of SQL Server. You can use the insert into SELECT statement to copy data from one table to another:

Two tables are in the same database:

Insert into encode (Code, name, description, type, parent_code, boundary, center_point, boundary_hole, boundary_hole_id, is_thematicmap, supportfile_code, boundary_all)
Select Code, name, description, type, parent_code, boundary, center_point, boundary_house, boundary_hole_id, is_thematicmap, suppfilefile_code, boundary_all from mapping_geodata_boundary

Two tables are in different databases (openquery ):

Insert mapping_geodata_boundary
(Code, name, description, type, parent_code, boundary, center_point, boundary_hole, boundary_hole_id, is_thematicmap)
Select Code, name, description, type, parent_code, boundary, center_point, boundary_hole, role, is_thematicmap from openquery ([10.10.1.31], 'select code, name, description, type, parent_code, boundary, center_point, boundary_hole, boundary_hole_id,
Is_thematicmap from epro30.dbo. mapping_geodata_boundary ')
If you want to create a database chain in different databases:

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.