Showing posts with label driver. Show all posts
Showing posts with label driver. Show all posts

Thursday, March 29, 2012

datatype map - Native ODBC driver

Hi,

Our software uses native ODBC driver and Visual C++ 2003 to communicate with SQL Server 2005.

SELECT xml_schema_namespace(SCHEMA_NAME(schema_id) ,name) FROM sys.xml_schema_collections.

SQLDescribeColW returns -152 as the datatype for the column in the above select statement. However, I’m unable to find a preprocessor definition for -152. The datatype looks like an nvarchar. Is it an nvarchar? Where can I find the definition for this datatype?

I have discovered similar problems while bringing back SQL_VARIANT types. The returned subtype of a SQLVariant comes up with -16 and -25. I cannot find definitions for these sub types either.

Any help is appreciated.

Regards,

Venkat

-152 is the XML data type and is defined in SQLNCLI.H as SQL_SS_XML. SQLNCLI.H is the header file for the SQL Native Client ODBC driver and OLEDB provider for SQL Server 2005.

I would advice you use the SQL Native Client ODBC driver for the best performance and functionality with SQL Server 2005. You can download the redistributable from http://www.microsoft.com/downloads/details.aspx?FamilyId=DF0BA5AA-B4BD-4705-AA0A-B477BA72A9CB&DisplayLang=en

Regards,

Uwa.

|||

Thank you very much!

Do you know where i can find information about SQL variant sub types -16 & -25? Subtype -16 looks like an integer (4bytes) while subtype -25 looks like a bigint (8Bytes)

Regards,

|||

-16 = "SQL_INTEGER + SQL_SIGNED_OFFSET" ( = 4 + (-20) )

-25 = "SQL_BIGINT + SQL_SIGNED_OFFSET" ( = -5 + (-20) )

So, basically they're SIGNED LONG and SIGNED BIGINT respectively, which explains their sizes of 4bytes and 8bytes.

You can find these defined in the header file SQLEXT.H:

#define SQL_BIGINT (-5)
...

#define SQL_SIGNED_OFFSET (-20)
#define SQL_UNSIGNED_OFFSET (-22)

....

#define SQL_C_SBIGINT (SQL_BIGINT+SQL_SIGNED_OFFSET) /* SIGNED BIGINT */
...

#define SQL_C_SLONG (SQL_C_LONG+SQL_SIGNED_OFFSET) /* SIGNED INTEGER */

As Uwa mentioned above, you'll need to search SQLNCLI.H for the SQL Server 2005 types. Here you can find (-152) defined:

#define SQL_SS_VARIANT (-150)
#define SQL_SS_UDT (-151)
#define SQL_SS_XML (-152)

|||Thanks a lot!sql

datatype

does any know how sqlserver 2000 'text' datatype is mapped in sqlserver JDBC driver? where can i find documentation of for data mapping between sqlserver datatypes and jdbc datatypes?
neo wrote:

> does any know how sqlserver 2000 'text' datatype is mapped in sqlserver JDBC driver? where can i find documentation of for data mapping between sqlserver datatypes and jdbc datatypes?
Hi. The simple test would be to query a text column and do a getObject() and see
what sort of object you got. However, it is simple just to tell the driver what
sort of object you want, by doing a getString() if you want a string, getAsciiStream()
if you want a stream, etc.
Joe Weinstein at BEA
|||The document from "SQLServer 2000 driver for JDBC User's Guide and
Reference" - 3 SQL Server 2000 Driver for JDBC - Data Types have this
information.
"neo" <anonymous@.discussions.microsoft.com> bl
news:19024BF8-645E-45E9-B014-DD475462204D@.microsoft.com g...
> does any know how sqlserver 2000 'text' datatype is mapped in sqlserver
JDBC driver? where can i find documentation of for data mapping between
sqlserver datatypes and jdbc datatypes?