Field Names and Aliases

Log Parser

Field Names and Aliases

<field_name> ::= [ [ ] <string> [ ] ]
<alias> ::= [ [ ] <string> [ ] ]

Field names are names of fields of the input records generated by an input format.

Aliases are alternative names for field-expressions, assigned in the SELECT or USING clauses. When a field-expression in the SELECT clause has been aliased, output formats will use the alias as the name of the corresponding output record field.
The alias of a field-expression can be also used anywhere else in the query as a shortcut that refers to the original field-expression.


Remarks:

  • The following characters are not allowed in field names or aliases, unless the field name or alias is enclosed in square brackets ( [ and ] ):
    , ; < > = ! ' " @ * [ ] space
    Field names and aliases containing spaces or illegal characters can be enclosed in square brackets ( [ and ] ), as in the following example:
    SELECT [Last Request Time], [email@address], CPUTime as [Elapsed CPU Time]
    FROM perflog.csv
    WHERE [Elapsed CPU Time] > 0
    
  • Any character (including illegal characters and non-printable characters) in field names and aliases can be also entered using the \uxxxx notation, where xxxx is the 4-digit hexadecimal representation of the UNICODE character:
    SELECT Last\u0020Request\u0020Time
    FROM perflog.csv
    
  • Field names and aliases can not match keywords or function names of the Log Parser SQL-Like language (e.g. "FROM", "ADD").
  • Field names and aliases are not case-sensitive.


Examples:

A. Basic field-expressions

The SELECT clause in the following example query specifies "basic" field-expressions only:
SELECT 'Event ID:', EventID, SYSTEM_TIMESTAMP()
FROM System

B. Derived field-expressions

The SELECT clause in the following example query specifies "derived" field-expressions only:
SELECT TO_UPPERCASE(cs-uri-stem), SUM(sc-bytes)
FROM \MyLogs\ex042805.log
GROUP BY TO_UPPERCASE(cs-uri-stem)


See also:

SELECT
USING

Basics of a Query


© 2004 Microsoft Corporation. All rights reserved.