使用Sql插入sde是ObjectId的处理方式
使用ArcGIS导入或新增数据时,objectid会自动自增,但通过sql时,则需要手动调用sde的函数sde.next_rowid来处理,否则可能导入objectid的重复;
- next_rowid的定义
Next_RowID 将注册到地理数据库的表作为输入参数,并返回 ObjectID (RowID) 字段的下一个值。
使用 SQL 将一行插入到表中时,可以使用此值。
如果您指定的表未注册到地理数据库,则返回错误
1 | <geodatabase administrator schema >.next_rowid (< table owner>, < table name >) |
在大多数地理数据库中,地理数据库管理员方案是 sde。但是,在 SQL Server dbo 方案地理数据库中,则为 dbo;而在 Oracle 用户方案地理数据库中,则为用户方案的名称。
- PostgreSQL
1 2 3 4 5 | INSERT INTO webman.applicants (objectid, app_name, status) VALUES (sde.next_rowid( 'webman' , 'applicants' ), 'Roy Bean' , 'active' ) Query returned successfully: 1 row affected, 109 ms execution time . |
1 2 3 4 5 | INSERT INTO webman.logins (id, l_name) VALUES (sde.next_rowid( 'WEBMAN' , 'LOGINS' ), 'maplebutter' ) Notice: Class webman.logins not registered to the Geodatabase. |
- Oracle
1 2 3 4 5 6 7 | INSERT INTO webman.applicants (objectid, app_name, status) VALUES (sde.gdb_util.next_rowid( 'WEBMAN' , 'APPLICANTS' ), 'Roy Bean' , 'active' ); 1 row created COMMIT ; |
1 2 3 4 5 6 7 8 9 | INSERT INTO webman.logins (id, l_name) VALUES (sde.gdb_util.next_rowid( 'WEBMAN' , 'LOGINS' ), 'maplebutter' ); (sde.gdb_util.next_rowid( 'WEBMAN' , 'LOGINS' ), 'maplebutter' ); * ERROR at line 3: ORA-20220: Class WEBMAN.LOGINS not registered to the Geodatabase. |
参考地址:https://resources.arcgis.com/zh-cn/help/main/10.1/index.html#/na/006z000000w8000000/
分类:
学习笔记
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 为DeepSeek添加本地知识库
· 精选4款基于.NET开源、功能强大的通讯调试工具
· DeepSeek智能编程
· [翻译] 为什么 Tracebit 用 C# 开发
· 腾讯ima接入deepseek-r1,借用别人脑子用用成真了~