On Thu04-Apr-2011 09:47 , James Lampert wrote:
I was led to believe that field names (unless quoted) only accepted
uppercase letters, digits, and underscores. And yet I just learned
empirically that "#" is also allowed. Any other allowable characters
I don't know about?
Field names [column names] are known by SQL as "identifiers". Some
links that might be worthwhile; see also "Note:" below:
SQL identifiers
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzsqlidts.htm
"There are two types of SQL identifiers: ordinary identifiers and
delimited identifiers.
* An ordinary identifier is an uppercase letter followed by zero or
more characters, each of which is an uppercase letter, a digit, or the
underscore character. Note that ordinary identifiers are converted to
uppercase. An ordinary identifier should not be a reserved word."
Identifiers
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzch2iden.htm
"An identifier is a token used to form a name. An identifier in an SQL
statement is an SQL identifier, a system identifier, or a host identifier.
Note: $, @, #, and all other variant characters should not be used in
identifiers because the code points used to represent them vary
depending on the CCSID of the string in which they are contained. If
they are used, unpredictable results may occur."
Naming conventions
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzch2nam.htm
"column-name
A qualified or unqualified name that designates a column of a table
or a view. The unqualified form of a column-name is an SQL identifier.
..." ...
"system-column-name
An unqualified name that designates the IBM i column name of a
table or a view. A system-column-name is a system identifier.
System-column-names can be delimited identifiers, but the characters
within the delimiters must not include lowercase letters or special
characters."
Class AS400SQLNameFormatter
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/rzahh/javadoc/com/ibm/as400/ui/util/AS400SQLNameFormatter.html
"public class AS400SQLNameFormatter
extends AS400Formatter
Checks validity of a string as an AS/400 SQL identifier.
A valid SQL Name is:
* 1 to 128 characters
* first character 'A'-'Z', '$', '#', '@'
* other characters 'A'-'Z', '0'-'9', '$', '#', '@', '_'
A valid SQL Name in Quoted Form:
* 1 to 130 characters including quotes
* starts and ends with " (double quote)
* All characters valid except: EBCDIC x00 - x3F, xFF. "
Regards, Chuck
As an Amazon Associate we earn from qualifying purchases.