使用ArcGIS导入或新增数据时,objectid会自动自增,但通过sql时,则需要手动调用sde的函数sde.next_rowid来处理,否则可能导入objectid的重复;
- next_rowid的定义
Next_RowID 将注册到地理数据库的表作为输入参数,并返回 ObjectID (RowID) 字段的下一个值。
使用 SQL 将一行插入到表中时,可以使用此值。
如果您指定的表未注册到地理数据库,则返回错误
<geodatabase administrator schema>.next_rowid (<table owner>, <table name>)
在大多数地理数据库中,地理数据库管理员方案是 sde。但是,在 SQL Server dbo 方案地理数据库中,则为 dbo;而在 Oracle 用户方案地理数据库中,则为用户方案的名称。
- PostgreSQL
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.
INSERT INTO webman.logins (id, l_name) VALUES (sde.next_rowid('WEBMAN', 'LOGINS'), 'maplebutter') Notice: Class webman.logins not registered to the Geodatabase.
- Oracle
INSERT INTO webman.applicants (objectid, app_name, status) VALUES (sde.gdb_util.next_rowid('WEBMAN', 'APPLICANTS'), 'Roy Bean', 'active'); 1 row created COMMIT;
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/
标签:name,ObjectId,webman,WEBMAN,next,sde,rowid,Sql From: https://www.cnblogs.com/loveyl/p/18208322