English

How To: Extract the ID for a geometric network in a SQL Server database

Summary

Geometric networks are tracked in the following tables:

  • GDB_ITEMS
  • GDB_ITEMTYPES
  • GDB_ITEMRELATIONSHIPS

In addition to these tables, networks are made up of a set of variably sized tables that are stored in the schema of the user who created the geometric network.

There are nine fixed tables per network, and they are identified by the following naming convention: N_<ID>_<table_descriptor>, where ID represents the OBJECTID of the network in the GDB_ITEMS table.

For example: N_1_<table descriptor>, N_2_<table descriptor>.

The following tables are always created:

  • N_<ID>_Desc
  • N_<ID>_E<#>
  • N_<ID>_ESTATUS
  • N_<ID>_ETOPO
  • N_<ID>_FLODIR
  • N_<ID>_JDESC
  • N_<ID>_JSTATUS
  • N_<ID>_JTOPO
  • N_<ID>_PROPS

Procedure

In SQL Server Management Studio, use the following query to obtain the ID of the geometric network:

use <database name> 

SELECT name, Definition.value('(/DEGeometricNetwork/LogicalNetworkID) [1]', 'nvarchar(max)') AS "ID" FROM sde.GDB_ITEMS 
where name = '<database name>.<user name>.<geometric network name>';

The above query syntax is provided for a geodatabase schema owned by sde. If the geodatabase schema is owned by dbo, then run the below query:

use <database name> 

SELECT name, Definition.value('(/DEGeometricNetwork/LogicalNetworkID) [1]', 'nvarchar(max)') AS "ID" FROM dbo.GDB_ITEMS 
where name = '<database name>.<user name>.<geometric network name>';

Related Information