conversion of ODBC SQL data types to ODBC C data types

conversion of ODBC SQL data types to ODBC C data types

Post by R.A.Veldhuijse » Thu, 27 May 1999 04:00:00



Hi,

I have written an extended stored procedure dll for SQL server 6.5 which
I use to run select statements on an Oracle Database using a system DSN.

I use the following functions:

SQLColAttribute(hstmt, i, SQL_DESC_CONCISE_TYPE,  NULL, 0, NULL,
(SQLPOINTER) &SQLType);

- returns the ODBC SQL type in variable SQLType (e.g. SQL_VARCHAR)

SQLBindCol(hstmt, i, SQLType, data[i], ColLen[i], &ColLenT[i]);

- needs the ODBC C data type in SQLType (e.g. SQL_C_CHAR);

how can I convert the ODBC SQL data type to an ODBC C data type ?

Besides that, the extended stored procedure will return the data in a result
set
which I use the following function:

srv_describe(srvproc, i, &ColName[i], SRV_NULLTERM, SQLType[i], (DBINT)
ColLen[i], SQLType[i], (DBINT) ColLen[i], (BYTE *) NULL);

How can I convert the ODBC SQL data type or ODBC C data type to ODS data
type (e.g. SRVCHAR) ?

thanks in advance

Robbert Veldhuijsen

 
 
 

conversion of ODBC SQL data types to ODBC C data types

Post by R.A.Veldhuijse » Thu, 27 May 1999 04:00:00


I now use a switch statement in which I convert SQL_VARCHAR to SQL_C_CHAR
and set the ODS data type to SVRVARCHAR

Also I use SQLColAttribute with 'SQL_DESC_OCTET_LENGTH' to determine the
maximum
size of the varchar column.

This doesn't work with the Oracle ODBC driver ('Descriptor type is out of
range' - probably wrong ODBC version) nor with the SQL server ODBC driver:

the varchar colum length returned with SQL_DESC_LENGTH or
SQL_DESC_OCTET_LENGTH are the same value, that is, the length of the Column
Name (? 8-)

With the Oracle ODBC driver, SQL_DESC_LENGTH on varchar2 (which is returned
as type SQL_VARCHAR) does work (but should not as described by microsoft)

Does anyone know what might be wrong ?

thanks in advance


Quote:> Hi,

> I have written an extended stored procedure dll for SQL server 6.5 which
> I use to run select statements on an Oracle Database using a system DSN.

> I use the following functions:

> SQLColAttribute(hstmt, i, SQL_DESC_CONCISE_TYPE,  NULL, 0, NULL,
> (SQLPOINTER) &SQLType);

> - returns the ODBC SQL type in variable SQLType (e.g. SQL_VARCHAR)

> SQLBindCol(hstmt, i, SQLType, data[i], ColLen[i], &ColLenT[i]);

> - needs the ODBC C data type in SQLType (e.g. SQL_C_CHAR);

> how can I convert the ODBC SQL data type to an ODBC C data type ?

> Besides that, the extended stored procedure will return the data in a
result
> set
> which I use the following function:

> srv_describe(srvproc, i, &ColName[i], SRV_NULLTERM, SQLType[i], (DBINT)
> ColLen[i], SQLType[i], (DBINT) ColLen[i], (BYTE *) NULL);

> How can I convert the ODBC SQL data type or ODBC C data type to ODS data
> type (e.g. SRVCHAR) ?

> thanks in advance

> Robbert Veldhuijsen


 
 
 

1. Disallowed implicit conversion from data type nvarchar to data type money

Hello everyone,

I have been trying to learn how to use the UpdateGram
feature of XMLSQL, however when I try to update a record
in my database I receive the following error message.

<?MSSQLError HResult="0x80040e07" Source="Microsoft OLE DB
Provider for SQL Server" Description="Disallowed implicit
conversion from data type nvarchar to data type money,
table 'ric.dbo.SSDRecov', column 'GrossAmt'. Use the
CONVERT function to run this query."?>

The values for the parameters are submitted from an ASP
Form using the post method.

The updategram is as follows:
<?xml version="1.0" ?>
<ldtData xmlns:updg="urn:schemas-microsoft-com:xml-
updategram">
  <updg:header>
    <updg:param name="SSDRecovID" />
    <updg:param name="oldGrossAmt" />
    <updg:param name="GrossAmt" />
  </updg:header>
  <updg:sync mapping-schema="schemas/ssdrecov.xml">
    <updg:before>
      <SSDRecov SSDRecovID="$SSDRecovID"
GrossAmt="$oldGrossAmt" />
    </updg:before>
    <updg:after>
      <SSDRecov GrossAmt="$GrossAmt" />
    </updg:after>
  </updg:sync>
 </ldtData>

The Schema file is as follows:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
        <xsd:element name="SSDRecov"
sql:relation="SSDRecov">
                <xsd:complexType>
                        <xsd:attribute name="SSDRecovID"
type="xsd:integer" />
                        <xsd:attribute name="ClaimNumber"
type="xsd:integer" />
                        <xsd:attribute
name="ClaimantNumber" type="xsd:integer" />
                        <xsd:attribute name="AsOfDate"
type="xsd:dateTime" />
                        <xsd:attribute name="GrossAmt"
type="xsd:decimal" />
                        <xsd:attribute name="ResinsAmt"
type="xsd:decimal" />
                        <xsd:attribute name="RoundedNet"
type="xsd:decimal" />
                </xsd:complexType>
        </xsd:element>
</xsd:schema>

When I hard code the values instead of using the
parameters everything works fine.  What am I doing wrong
here?

-- Jeff Gochin

2. Question on moving Online from one machine to another

3. Data type conversion error when saving numeric data types

4. Trade Delphi 3.0 for Paradox Runtime for DOS 4.5

5. Data Transfer from Long data type to SQL Server Text data type column

6. CA-San Jose-267372--ORACLE-ORACLE Tools-Client/Server-CGI-C-C++-Perl-HTML-UNIX-S

7. sql data type vs vb data type

8. Mapping SQL Server Data Types and ADO Data Type Enums

9. Data Type SQL Server7.0 need a non decimal 1 E 19 data type

10. SQL timestamp data type - correspondency with c++ data type

11. Mapping ADO Data Types to SQL Server Data Types

12. Best ODBC data type for Boolean data