This project is read-only.

Problems using

Topics: User Forum
Sep 14, 2006 at 3:03 AM
deployed via: msscmd -deploy -server=localhost -db=mapserver

got a ST.GEOMETRYCOLUMNS and ST.SPACIALREF_SYS and some stored procedures.....

Tried to add a column to a table

USE mapserver

DECLARE @return_value int

EXEC @return_value = ST.AddGeometryColumn
@table_name = N'test',
@column_name = N'bbox'

SELECT 'Return Value' = @return_value


and got an error

Msg 6522, Level 16, State 1, Procedure AddGeometryColumn, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'AddGeometryColumn':
System.Data.SqlClient.SqlException: Invalid column name 'oid'.
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0.
at StoredProcedures.AddGeometryColumn(SqlString schemaname, SqlString tablename, SqlString column_name, SqlInt32 srid, SqlString type)

(1 row(s) affected)

Any help is appreciated
Sep 15, 2006 at 7:05 AM
Sorry, I have not mentioned this in the documentation: It's mandatory to have a column called "oid" in the tables you want to "spatialize" using ST.AddGeometryColumn. The "oid" column may or may not be the primary key, but must be unique and integer. Tables created by importing from shapefiles or PostGIS tables has an "oid" column by default.

If you want to suggest another approach, you're welcome to download the source code and review how "oid" columns are used. Surely there's a better way to make it...
Sep 18, 2006 at 4:32 PM
Thanks for the reply. I think that all is working now. I may take a look at the code and see if I can figure something better out. Would be nice to be able to specifiy a column to act as the oid. Might be able to alias it or something.


Sep 20, 2006 at 8:18 PM
Why not just require that there is a primary key?
Sep 22, 2006 at 11:20 AM
This discussion has been copied to Work Item 3553. You may wish to continue further discussion there.
Jan 26, 2007 at 4:13 PM
Just for the record: Primary keys with arbitrary name

Best regards,
Ricardo Stuven.