The ST_SRID() function

The ST_SRID() function takes an ST_Geometry object and returns its spatial reference ID.

Syntax

ST_SRID(g1 ST_Geometry)

Return type

INTEGER

Example

During the registration of the spatial extension, the spatial_references table is created by this CREATE TABLE statement:
CREATE TABLE sde.spatial_references
(
    srid               integer       NOT NULL,
    description        varchar(64),    
    auth_name          varchar(255),
    auth_srid          integer,
    falsex             float         NOT NULL,
    falsey             float         NOT NULL,
    xyunits            float         NOT NULL,
    falsez             float         NOT NULL,
    zunits             float         NOT NULL,
    falsem             float         NOT NULL,
    munits             float         NOT NULL,
    srtext             char(2048)    NOT NULL,
  PRIMARY KEY (srid) 
      CONSTRAINT sde.sp_ref_pk
);
Before you can create geometry and insert it into a table, you must enter the SRID of that geometry into the spatial_references table. This is a sample insert of a spatial reference system. The spatial reference system has an SRID value of 1, a false X, Y of (0,0), and its system units are 100. The Z coordinate and measure offsets are 0, while the Z coordinate and measure units are 1.
INSERT INTO spatial_references
     (srid, description, auth_name, auth_srid, falsex, falsey,
      xyunits, falsez, zunits, falsem, munits, srtext)
   VALUES (1, NULL, NULL, NULL, 0, 0, 100, 0, 1, 0, 1, 'UNKNOWN');
Important: Choose the parameters of a spatial_references table entry with care.
The following table is created for this example:
CREATE TABLE srid_test(g1 ST_Geometry);
In the next statement, an ST_Point geometry located at coordinate (10.01,50.76) is inserted into the geometry column g1. When the ST_Point geometry is created by the ST_PointFromText() function, it is assigned the SRID value of 1:
INSERT INTO srid_test VALUES(
   ST_PointFromText('point(10.01 50.76)',1000)
);
The ST_SRID() function returns the spatial reference ID of the geometry just entered:
SELECT ST_SRID(g1)
   FROM srid_test;

(expression) 

        1000