Select to view content in your preferred language

Query SQL to show all table names and the SRID

743
2
Jump to solution
03-28-2023 09:41 AM
byander
New Contributor II

Hello,

I need to create a query SQL to show all table names and the SRID (EPSG Code) from each table on Enterprise Geodatabase SQL Server. 
Currently, I can use this SQL to show the Srid for one table:

SELECT DISTINCT SHAPE.STSrid AS espg_code FROM table_name;

But I need to show Srid for all geometry tables in the database.

I tried some queries but without success.

0 Kudos
1 Solution

Accepted Solutions
CoffeeforClosers
New Contributor III

 

SELECT l.database_name [DatabaseName],
l.table_name [TableName],
l.owner [SchemaOwner],
sr.auth_srid [SRID],
srtext [WKT]
FROM [database].[dbo].[SDE_layers] l
inner join database.dbo.SDE_spatial_references sr
on l.srid = sr.srid

 

View solution in original post

2 Replies
CoffeeforClosers
New Contributor III

 

SELECT l.database_name [DatabaseName],
l.table_name [TableName],
l.owner [SchemaOwner],
sr.auth_srid [SRID],
srtext [WKT]
FROM [database].[dbo].[SDE_layers] l
inner join database.dbo.SDE_spatial_references sr
on l.srid = sr.srid

 

byander
New Contributor II

Tank's @CoffeeforClosers , it works!!!!

0 Kudos