`
thecloud
  • 浏览: 934377 次
文章分类
社区版块
存档分类
最新评论

insert into select语句【可以复制Geometry字段】

 
阅读更多

SQL Server自带的导入导出功能可以导普通的属性表:

但是,如果你要复制的表中存在Geometry字段,如果用Sql server自带的导入导出表的功能将无法导入带Geometry字段的表。可以用insert into select语句将一个表中的数据复制到另一表中:

两个表在同一数据库中:

insert INTO mapping_geodata_boundary_code(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_hole, boundary_hole_id, is_thematicmap, supportfile_code, boundary_All from mapping_geodata_boundary

两个表在不同数据库中( 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, boundary_hole_id, 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')
如果在不同的数据库中,还需要创建数据库链:

分享到:
评论

相关推荐

    Oracle为sdo_geometry创建空间索引

    INSERT INTO user_sdo_geom_metadata VALUES ( 'G_GADGETS_TC2_LF_520', 'SHAPE', MDSYS.SDO_DIM_ARRAY( MDSYS.SDO_DIM_ELEMENT('X', -180, 180, 0.005), MDSYS.SDO_DIM_ELEMENT('Y', -90, 90, 0.005) ), ...

    sqlserver空间数据操作

    例如,以下语句创建了一个名为streets的表,其中包含id、名称和几何形状三个字段,几何形状字段类型为geometry。 ```sql CREATE TABLE streets( streetid INT IDENTITY(1,1), streetName NVARCHAR(20), streetGeo...

    ORACLE SPATIAL 笔记(完整版)

    以上 SQL 语句创建了一个名为 `cola_markets` 的表,其中 `shape` 字段使用了 SDO_GEOMETRY 类型。 接下来,我们将向表中插入四条包含不同几何体的数据: 1. **Cola A** - 一个矩形: ```sql INSERT INTO cola_...

    使用MySQL的geometry类型处理经纬度距离问题的方法

    INSERT INTO map (id, address, location) VALUES (1, 'somewhere', ST_GeomFromText('POINT(121.366961 31.190049)')); ``` 这里,`POINT(121.366961 31.190049)`表示了一个经度为121.366961,纬度为31.190049的...

    用python内置数据库sqite3和TK界面实现图书管理器

    c.execute("INSERT INTO books VALUES (NULL, '书名', '作者', '出版日期')") ``` 4. **查询数据**: 使用`SELECT`语句查询数据: ```python c.execute("SELECT * FROM books") rows = c.fetchall() for row...

Global site tag (gtag.js) - Google Analytics