My favorites | Sign in
Project Logo
             
New issue | Search
for
| Advanced search | Search tips
Issue 46: mssql unique identifier data type
1 person starred this issue and may be notified of changes. Back to list
Status:  Investigating
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by jeremiah.campbell, Apr 07, 2009

What steps will reproduce the problem?

mssql has a uniqueidentifier data type.  When I select these fields directly I am getting inaccurate data.
if i cast the field inside the select statement I get back accurate data.

produces whacky results: select uniqueidnetifiercolum from sometable

produces good results: select cast(uniqueidentifiercolum as nvarchar(36)) as col from sometable

i can find no documentation on whether or not the unique identifier data type is supported in pyodbc.

What is the expected output? What do you see instead?

i see values like this:
 CF2FBFAC-FB1B-42E4-garbly gook that is different ever time I run it.

when I should get something like this:
 CF2FBFAC-FB1B-42E4-B63B-FE263350089C

What version of the product are you using? On what operating system?

environment
- Mac OSX 10.5 
- latest stable pyodbc
- mssql 2005
- latest Actual ODBC Driver

Please provide any additional information below.

In the "garbly gook" I have seen everything from random characters to the name of the python file I am running.
Comment 1 by mkleehammer, Apr 08, 2009
As mentioned in the Data Types page (http://code.google.com/p/pyodbc/wiki/DataTypes)
GUIDs are returned as strings.  They are supposed to be supported.

The SQL Server unittests have a couple that select new GUIDs, but it is possible that
they aren't read from a table correctly.  I'll have to add more tests for that. 
Comment 2 by mkleehammer, Apr 19, 2009
Can you upload an ODBC trace of this?  This is working on Windows and there is a unit
test for this in the SQL Server unit tests.

I'd like to see exactly what data type it is being returned and what the length is.

Status: Investigating
Comment 3 by jeremiah.campbell, Oct 01, 2009
I have recently upgraded to latest pyodbc off of github, dropped commercial Actual Technologies odbc driver, 
installed latest stable freetds, and upgraded to snow leopard.  I can not point to which one of these fixed this 
problem but I am no longer seeing it.

Sorry I have not had time to do more testing to isolate exactly what was causing the problem on my end but I am 
glad it is working.
Sign in to add a comment

Hosted by Google Code