Opened 16 years ago

Closed 16 years ago

#231 closed defect (fixed)

SQLServer Spatial: The order of inserted properties counts

Reported by: danstoica Owned by: danstoica
Priority: major Milestone: 3.3.0
Component: SQLServer Spatial Version: 3.2.0
Severity: 1 Keywords:
Cc: External ID:

Description

This is about a SqlServer2008 bug. Say we have this insert statement:

INSERT INTO dbo.TEST_GEOM("ID", "GEOM", "STR1”) VALUES (?, Geometry::STGeomFromText(?, 0), ?);

SQLPrepare() will succeed but describe columns (SQLDescribeParam) will fail with “[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index” for each column in the statement.

What the provider's ODBC driver is doing in such case is to default the column type to CHAR, length=100. This is exactly what we are experiencing: all the strings get padded with spaces up to 101 chars.

Why is it failing? Apparently the geometry column has to be bound as the last column in the insert statement. This statement will succeed:

INSERT INTO dbo.TEST_GEOM("ID", "STR1”, "GEOM",) VALUES (?, ?, Geometry::STGeomFromText(?, 0));

Until MS is fixing the bug a workaround is feasable: in the provider just place the geometry properties at the end of the insert string.

Change History (1)

comment:1 by danstoica, 16 years ago

Resolution: fixed
Severity: 31
Status: newclosed
Note: See TracTickets for help on using tickets.