Skip to Content.
Sympa Menu

freetds - [freetds] How to get the value type returned from the SQL_VARIANT column (db-lib)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Sergey Pashkov <sergey_pashkov AT valentina-db.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] How to get the value type returned from the SQL_VARIANT column (db-lib)
  • Date: Fri, 17 Nov 2017 12:26:22 +0200

Hello,

I'm using:
1) db-lib freetds-1.00.70, on macOS
2) SQL Server 2017 on Linux

TDS protocol is set to 7.2

Here's a sample table:
CREATE TABLE t1( f1 SQL_VARIANT );
INSERT INTO t1 VALUES( 'string' );
INSERT INTO t1 VALUES( 55 );

I retrieve the data from this table
SELECT * FROM t1;

BYTE* msData = dbdata( hnd, i + 1 );
msData points to correct data - string and number respectively.

But how can I get the type of this data? Is it possible at all?

I can see internally it is stored in the TDSVARIANT structure, but dbdata
returns just the data.

Thank you!

--
Best regards,
Sergey Pashkov



  • [freetds] How to get the value type returned from the SQL_VARIANT column (db-lib), Sergey Pashkov, 11/17/2017

Archive powered by MHonArc 2.6.24.

Top of Page