DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I interpret the SQL_ColType() numerical values?

Solved!
Go to solution

Hello,

after executing:
..
Call SQL_Connect("abcDB","user","pw","") ' abcDB is a ODBC link to my Mysql 5 database
Call SQL_ExecDirect("SELECT id,temperature,tsdat FROM v$_header WHERE id < 1000")
..

>> the variable SQL_ColType(1..ColumnNo) shows me the datatypes of each column as a numerical value e.g.:


SQL_ColType(1) = 4
SQL_ColType(2) = -9
SQL_ColType(3) = 93

 

Which real database types are behind the values? It would be nice to get a complete list of all possible values?

 

Thank you.

 

0 Kudos
Message 1 of 2
(3,092 Views)
Solution
Accepted by topic author KErotate

Hi ddehn,

 

The SQL_...() commands are the old method for DIAdem to connect to SQL data bases, using the ODBC approach.  Since DIAdem 10.2 the ADO approach is the recommended method.  This is the function I used to use to makes sense of the SQL_ColType() values:

 

Function GetODBColTypes()
  Dim j, jMax, ChTypes
  jMax = SQL_ResultCols
  IF jMax < 1 THEN jMax = 0
  ReDim ChTypes(jMax)
  FOR j = 1 TO jMax
    IF SQL_ColType(j) = 93 THEN
      ChTypes(j) = "DateTime"   
    ElseIF SQL_ColType(j) = -1 OR SQL_ColType(j) > 8 THEN ' STRING
      ChTypes(j) = "String"
    ELSE
      ChTypes(j) = "Number"
    END IF ' SQL_ColType(j)
  NEXT ' j
GetODBColTypes = ChTypes
End Function ' GetODBColTypes()

  

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 2
(3,077 Views)