Table of contents
TOC
Collapse the table of content
Expand the table of content

usql.columns (U-SQL)

Michael Rys|Last Updated: 5/15/2018
|
4 Contributors

Returns a row for each column in tables and table types in the schemas of the current database context.

Column nameData typeDescription
namestringColumn's name (unique within the object to which the column belongs)
object_id_guidGuidIdentifier of the object to which the columns belongs
column_idintColumn's positional id within the object to which the column belongs (unique within the object)
type_id_guidGuidColumn type's identifier.

To return the name of the type, join to the usql.types catalog view on this column.
max_lengthint?Column's maximum length in bytes.

-1 = Variable sized column such as columns of type string or byte[] or of a complex type. The value null is reserved for future use.

Examples

The examples can be executed in Visual Studio with the Azure Data Lake Tools plug-in.

Query the usql.columns view

USE TestReferenceDB;

OUTPUT usql.columns
TO "/ReferenceGuide/CatalogViews/columns.txt"
USING Outputters.Tsv(outputHeader:true);

Query the usql.columns view with other catalog views

@columns =
    SELECT "object" AS object_type,
            o.name AS objectName,
            c.*
    FROM usql.columns AS c
    JOIN usql.objects AS o
    ON c.object_id_guid == o.object_id_guid

    UNION ALL

    SELECT  "type" AS object_type,
            t.name AS objectName,
            c.*
    FROM usql.columns AS c
    JOIN usql.types AS t
    ON c.object_id_guid == t.type_id_guid;

OUTPUT @columns
TO "/ReferenceGuide/CatalogViews/columns_objects_types.txt"
ORDER BY object_type, objectName, name
USING Outputters.Tsv(outputHeader:true);  

See Also

© 2018 Microsoft