Partager via


VARTYPE( ) Function

Returns the data type of an expression.

Note

VARTYPE( ) is similar to the TYPE( ) function, but VARTYPE( ) is faster and does not require quotation marks to enclose the expression for which the data type is returned.

VARTYPE(eExpression [, lNullDataType])

Parameters

  • eExpression
    Specifies the expression for which the data type is returned. VARTYPE( ) returns a single character indicating the data type of the expression.

    The following table lists the characters that VARTYPE( ) returns for each data type.

    Return value

    Data type

    C

    Character, Memo, Varchar, Varchar (Binary)

    D

    Date

    G

    General

    L

    Logical

    N

    Numeric, Float, Double, or Integer

    O

    Object

    Q

    Blob, Varbinary

    T

    DateTime

    U

    Unknown or variable does not exist

    X

    Null

    Y

    Currency

Note

If eExpression is an array, the first element in the array is evaluated.

  • lNullDataType
    Specifies whether VARTYPE( ) returns the data type when eExpression contains the null value.

    The following table lists the values of lNullDataType.

    lNullDataType

    Description

    True (.T.)

    Return data type for eExpression.

    False (.F.) or omitted

    Return 'X' to indicate eExpression contains a null value.

Return Value

Character. VARTYPE( ) returns a character representing the data type of the specified expression.

See Also

Reference

EVALUATE( ) Function

TYPE( ) Function

Other Resources

Data and Field Types

Functions

Language Reference (Visual FoxPro)