| Issue 103: | Inserting into a nullable geometry column in SQL Server 2008 fails when the bind parameter is given as None | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem?
1. Create a table with a nullable geometry column
CREATE TABLE spots (
spot_id INTEGER NOT NULL IDENTITY(1,1),
spot_height NUMERIC(6, 2) NULL,
spot_location GEOMETRY NULL,
PRIMARY KEY (spot_id)
)
2. 'INSERT INTO spots (spot_height, spot_location) OUTPUT inserted.spot_id VALUES (?, ?)' (420.39999999999998, None)
What is the expected output? What do you see instead?
The expected output is that the row with the NULL geometry is inserted into the database. Instead I get the following SQL Error:
"[22018] [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: image is incompatible with geometry (206) (SQLExecDirectW); [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (8180)"
What version of the product are you using? On what operating system?
pyodbc-2.1.7
Windows XP SP 3
SQL Server 2008
SqlAlchemy 0.6.1
Please provide any additional information below.
I am using pyodbc via SqlAlchemy. If I change the bind parameter from None to an explicit 'NULL', then it works as expected.
Sep 6, 2010
Project Member
#1
mkleehammer
Status:
Fixed
Nov 21, 2010
(No comment was entered for this change.)
Status:
Complete
|