sqlTypeInfo {RODBC}R Documentation

Request Information about Data Types in an ODBC Database

Description

Request information about data types in an ODBC database

Usage

sqlTypeInfo(channel, type = "all", errors = TRUE, as.is = TRUE)

Arguments

channel connection handle as returned by odbcConnect.
type The types of columns about which information is requested. Possible values are "all", "char", "varchar" , "real", "float", "double", "integer", "smallint", "timestamp".
errors if TRUE halt and display error, else return -1.
as.is as in sqlGetResults.

Details

sqlTypeInfo attempts to find the types of columns the database supports: not all ODBC drivers support this. Where it is supported, it is used to decide what column types to create when creating a new table in the database.

Value

A data frame on success, or character/numeric on error depending on the errors argument. Use sqlGetResults for further details of errors.
The columns returned depend on the ODBC driver: see ‘Exanples’.

Author(s)

Brian Ripley

See Also

sqlGetResults, odbcGetInfo

Examples

## Not run: 
## from a MySQL 5.0 driver
names(sqlTypeInfo(channel))
# [1] "TYPE_NAME"          "DATA_TYPE"          "COLUMN_SIZE"       
# [4] "LITERAL_PREFIX"     "LITERAL_SUFFIX"     "CREATE_PARAMS"     
# [7] "NULLABLE"           "CASE_SENSITIVE"     "SEARCHABLE"        
#[10] "UNSIGNED_ATTRIBUTE" "FIXED_PREC_SCALE"   "AUTO_UNIQUE_VALUE" 
#[13] "LOCAL_TYPE_NAME"    "MINIMUM_SCALE"      "MAXIMUM_SCALE"     
#[16] "SQL_DATATYPE"       "SQL_DATETIME_SUB"   "NUM_PREC_RADIX"    
#[19] "INTERVAL_PRECISION"
## End(Not run)

[Package RODBC version 1.2-6 Index]