ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / SQL functions
  • Detailed information about the columns
  • Tip: How to speed up the execution time of SQLColumn?
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns the characteristics of all the columns (or items):
  • for a given table.
  • for a given query.
WEBDEV - Browser code The SQL functions are used to handle the local databases (such as Web SQL databases). For more details, see Accessing a database in local mode (SQLite).
WEBDEV - Browser code SQLColumn returns only the characteristics of the columns for a given query. A result must have been returned by the query to get the query characteristics.
Example
// Connection to a database
Connection_Number is int
Connection_Number = SQLConnect(SourceName, "", "", "", "ODBC")
i is int
// LIST_TableList is a list containing the list of tables
i = LIST_TableList
IF i <> -1 THEN
ListAdd(LIST_List1, SQLColumn(Connection_Number, LIST_TableList[i]))
END
Syntax
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5OLE DBODBCNative Connectors (Native Accesses)

Columns of a given table Hide the details

<Result> = SQLColumn(<Connection number> , <Table name> [, <Details>])
<Result>: Character string
Name of the table columns.
  • If <Details> is set to False, the character string contains the name of each table column separated by CR:
    Column1 + CR + Column2 + CR + ... + ColumnN
  • If <Details> is set to True, the character string contains the name of each table column along with various information about the column (name, type, size):
    ColumnName + TAB + Type1 (N/T) + TAB + Type2 (number) + TAB + Size + CR

    This format is presented in the Remarks.
Java The results regarding the types and the sizes of columns may differ from the results returned in WINDEV.
<Connection number>: Integer
Number of the connection to use, returned by SQLConnect.
<Table name>: Character string
Name of the table whose columns are requested.
<Details>: Optional boolean
  • True (default option) for a detailed result,
  • False for a simplified result.

Columns of a given query Hide the details

<Result> = SQLColumn(<Query name> [, <Details>])
<Result>: Character string
  • If <Details> is set to False, the character string contains the name of each table column separated by CR characters (Carriage Return):
    Column1 + CR + Column2 + CR + ... + ColumnN
  • If <Details> is set to True, the character string contains the name of each table column along with various information about the column (name, type, size):
    ColumnName + TAB + Type1 (N/T) + TAB + Type2 (number) + TAB + Size + CR

    This format is presented in the Remarks.
Java The results regarding the types and the sizes of columns may differ from the results returned in WINDEV.
WEBDEV - Browser code Caution: The characteristics of the columns cannot be known if no result was returned by the query.
<Query name>: Character string
Name of the query (executed with SQLExec or SQLExecWDR) for which we want to get the columns.
WEBDEV - Browser code Only the queries created and run by SQLExec are available.
<Details>: Optional boolean
  • True for a detailed result,
  • False (default option) for a simple result.
Remarks

Detailed information about the columns

If <Details> is set to True, the character string contains the names of all the columns of a table along with some information about these columns (name, type, size) in the following format:
Column_Name + TAB + Type 1 (N/T) + TAB + Type 2 (number) + TAB + Size
  • Type 1 (N/T): "N" for numeric column, "T" for text column
  • Type 2: internal number indicating the exact type of the column (see the table)
    Type 1Type 2ODBC type
    N1SQL_BIT: Bit
    N2SQL_TINYINT: Integer
    N3SQL_BIGINT: Long integer
    N4SQL_LONGVARBINARY: Binary Memo
    N5SQL_VARBINARY: Variable-length binary string
    N6SQL_BINARY: Binary
    T7SQL_LONGVARCHAR: ASCII string memo
    T9SQL_CHAR: Fixed-length string
    N10SQL_NUMERIC: Numeric
    N11SQL_DECIMAL: Decimal number
    N12SQL_INTEGER: Integer
    N13SQL_SMALLINT: Integer
    N14SQL_FLOAT: Double real
    N15SQL_REAL: Single real
    N16SQL_DOUBLE: Double real
    T17SQL_DATE: Date
    T18SQL_TIME: Time
    T19SQL_TIMESTAMP: Date time
    T20SQL_VARCHAR: Variable-length string
    T0SQL_WCHAR: Variable-length Unicode string
    T-2SQL_WLONGVARCHAR: Unicode memo
  • Size: Displayable size of the column: size of the string for the character strings and size of the numeric value (in bytes) for the numeric values.
WEBDEV - Browser code In browser code:
  • Only two types are supported:
    Type 1Type 2ODBC type
    N16SQL_DOUBLE: Double real
    T0SQL_WCHAR: Variable-length Unicode string
  • the size is empty.
Reminder: The characteristics of the columns cannot be known if no result was returned by the query.
WINDEVWEBDEV - Server codeReports and QueriesJavaPHPAjax

Tip: How to speed up the execution time of SQLColumn?

The name of the table must be prefixed by the owner: the result will be nearly immediate:
SQLColumn(ConnectionNum, OWNER.CUSTOMER)
Component: wd290hf.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help