Fetching Uniqueidentifier from SqlServer with ODBC corrupts data (TD-25198)

Report bugs and possible workarounds.
Site Admin
Site Admin
Posts: 194
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Fetching Uniqueidentifier from SqlServer with ODBC corrupts data (TD-25198)

Post by thomas.uttendorfer » 13 May 2020, 09:21

Hi all,
I'd like to inform you about a bug we found in TD7.3.0:

Prerequisits for the bug to occur:
1) Connect to SqlServer via ODBC
2) Select a column with datatype "uniqueidentifier" and also one with datatype "text" or "varchar(max)"
3) The column of the "uniqueidentifier" must be after the one with datatype "text" in the select column list.

The error is:
The bindvar for the "uniqueidentifier" column shows only the first character - it should be a GUID with 36 characters.

The bug is already fixed and will be released with TD7.3.1 and TD7.2.3
Here is the repsonse from OpenText:
I would like to update you that our Development have fixed this defect TD-25198 "Fetching data from a column with datatype 'uniqueidentifier' in a SQL Server gives a corrupted data" in TD7.2.3 and TD7.3.1.
The TD7.3.1 release will be tentatively available in June 2020 and TD7.2.3 will be available in November 2020.
In the meantime workarounds are:
- put column with uniqueidentifier to the front of the select column list
- or connect via OLEDB to sqlserver.

Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH

Steve Leighton
Site Admin
Site Admin
New Zealand
Posts: 122
Joined: 05 Mar 2017, 20:57
Location: Tauranga, New Zealand <--> Stroud, England

Re: Fetching Uniqueidentifier from SqlServer with ODBC corrupts data (TD-25198)

Post by Steve Leighton » 14 May 2020, 04:25

Thank you for the information.
Another good reason to use the faster OLEDB . ( MSOLEDBSQL.1 )
Greetings from New Zealand

Bankside Systems Ltd. ( UK ♦ Australia ♦ New Zealand )

User avatar
Site Admin
Site Admin
Posts: 1024
Joined: 06 Mar 2017, 06:07
Location: Austria

Re: Fetching Uniqueidentifier from SqlServer with ODBC corrupts data (TD-25198)

Post by markus.essmayr » 25 May 2020, 18:53


I think you could also cast the column to varchar in your SQL.
As far as I know, the ODBC library implicitely casts uniqueidentifier to nvarchar (UNICODE string) and as you only receive the first character, it seems that TD assumes it to be an ANSI string by mistake.

Code: Select all

SELECT col1, col2, col3, CAST(col4 AS varchar(50)) FROM yourtable INTO :var1, :var2, :var3, :var4
If that works, it may be easier than moving to OLEDB.

Markus Eßmayr

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 0 guests