Recently, I needed to select records using the year portion of a six-digit numeric date field for the selection criteria. I discovered two ways to construct an SQL statement to accomplish this (see 10). The key to both methods is the DIGITS function. The DIGITS function returns a character representation of a numeric column. Since a numeric column can then be treated as a character column, the column can be used with the LIKE predicate and with the SUBSTR function.
Recently, I needed to select records using the year portion of a six-digit numeric date field for the selection criteria. I discovered two ways to construct an SQL statement to accomplish this (see Figure 10). The key to both methods is the DIGITS function. The DIGITS function returns a character representation of a numeric column. Since a numeric column can then be treated as a character column, the column can be used with the LIKE predicate and with the SUBSTR function.
-Mary Ann Warren
LATEST COMMENTS
MC Press Online