This project is read-only.

DropGeometryColumn does NOT work on 0.1.1

Topics: User Forum
Apr 12, 2007 at 11:22 PM
Hi,

I´m running MsSqlSpatial 0.1.1 production release and today I was able to drop a geometry field using ST.DropGeometryColumn function.

I created the geometry field using:

EXECUTE ST.AddGeometryColumn '','myTable','myGeom',4291,'POINT'

and tried to remove it using:

EXECUTE ST.DropGeometryColumn '','myTable','myGeom'

But this gave me the following error:
-------------------------------------
Msg 6522, Level 16, State 1, Procedure DropGeometryColumn, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "DropGeometryColumn":
System.Data.SqlClient.SqlException: 'enforcetypecentroide' is not a constraint.
Could not drop constraint. See previous errors.
System.Data.SqlClient.SqlException:
at StoredProcedures.DropGeometryColumn(SqlString schemaname, SqlString tablename, SqlString column_name)
-------------------------------------

Is this a bug? Or am I doing something wrong?

best regards,
Apr 13, 2007 at 4:03 PM
I've just tried the same commands you provide and they work fine. Even I tried to drop manually the constraints and then successfully execute DropGeometryColumn. Please, could you run the following query and tell me the result?:
select clr_name from sys.assemblies where name = 'MsSqlSpatialLibrary'

But the weirdest thing is in the error message... where that "centroide" keyword came from?

Best regards,
Ricardo Stuven.
Apr 13, 2007 at 8:22 PM
Hi Ricardo,

the SQL returns:

 mssqlspatiallibrary, version=0.1.2589.24988, culture=neutral, publickeytoken=f5d26ab2beee04e5, processorarchitecture=msil 

Sorry, the correct message is:
------------
-------------------------------------
Msg 6522, Level 16, State 1, Procedure DropGeometryColumn, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "DropGeometryColumn":
System.Data.SqlClient.SqlException: 'enforcetypemyGeom' is not a constraint.
Could not drop constraint. See previous errors.
System.Data.SqlClient.SqlException:
at StoredProcedures.DropGeometryColumn(SqlString schemaname, SqlString tablename, SqlString column_name)
-------------------------------------
Apr 13, 2007 at 8:30 PM
Hi Ricardo,

I´m sorry again but it was just my stupid big mistake.

I have 2 databases using MsSqlSpatial: the 1st was upgraded with 0.1.1 version and the 2nd was NOT.

Sorry.

Now it worked fine:
 Column [dbo].[myTable].[myGeom] removed.