Identifiers

Overview of Identifiers

An identifier is one or more tokens, or symbols, that name programming language entities, such as variables, method names, package names, and arrays, as well as data source objects, such as table names and column names.
FedSQL supports ANSI SQL:1999 core standards for both regular and delimited identifiers.
Regular identifiers are the type of identifiers that you see in most programming languages. They are not case-sensitive; the identifier “Name” is the same as “NAME” and “name”. Only certain characters are allowed in regular identifiers.
Delimited identifiers are case-sensitive, allow any character, and must be enclosed in double quotation marks.
By supporting ANSI SQL:1999 identifiers, FedSQL is compatible with data sources that also support the ANSI SQL:1999 identifiers.
Note: Identifiers for SAS data sets, SPD Engine data sets, and SPD Server tables are limited to 32 characters.
Note: When more than one data source is involved, the maximum length of an identifier is determined by the smallest maximum length that is supported by all of the data sources and FedSQL. For example, if your data sources are a SAS data set, which has a maximum of 32 characters, and MySQL, which has a maximum of 64 characters, the maximum length of an identifier would be 32 characters.

Regular Identifiers

When you name regular identifiers, use these rules:
  • The length of a regular identifier can be 1 to 256 characters.
  • The first character of a regular identifier must be a letter. Subsequent characters can be letters, digits, or underscores.
  • Regular identifiers are case-insensitive.
The following regular identifiers are valid:
firstName
lastName
phone_num1
phone_num2
Letters in regular identifiers are stored internally as uppercase letters, which allows letters to be written in any case. For example, phone_num1 is the same as Phone_Num1 and PHONE_NUM1.
Note: Each data source has its own naming conventions, all of which are accepted by FedSQL. If your program contains identifiers that are specific for a particular data source, you must follow the naming conventions for that data source. See your database documentation for information about its naming conventions.

Delimited Identifiers

When you name delimited identifiers, follow these rules:
  • The length of a delimited identifier can be 1 to 256 characters.
  • Begin and end delimited identifiers with double quotation marks.
  • Delimited identifiers consist of any sequence of characters, including spaces and special characters, between the beginning and ending double quotation marks.
  • Delimited identifiers are case-sensitive.
A string of characters enclosed in double quotation marks is interpreted as an identifier and not as a character constant. Character constants can be enclosed only in single quotation marks.
Here is a list of valid delimited identifiers:
" x y z"
"Ü1"
"phone_num"
"a & B"
Letters in delimited identifiers are case-sensitive and their case is preserved when they are stored in FedSQL. When they are stored, the double quotation marks are removed. The identifier “phone_num” is not equivalent to “Phone_Num” or “PHONE_NUM”. The delimited identifier “PHONE_NUM” is equivalent to the regular identifier “phone_num”.
You can use delimited identifiers for terms that might otherwise be a reserved word. For example, to use the term “char” other than for a character declaration, you would use it as the delimited identifier “char”. For more information, see FedSQL Reserved Words.
Note: Each data source has its own naming conventions, all of which are accepted by FedSQL. When your program contains identifiers that are specific for a particular data source, you must follow the naming conventions for that data source. See your database documentation for information about table naming conventions for data source objects.

Referencing a Macro Variable in a Delimited Identifier

To reference a SAS macro variable in a delimited identifier, use the SAS macro function %TSLIT, which overrides the need for double quotation marks around the literal string and puts single quotation marks around the input value.
The %TSLIT macro function is stored in the default autocall macro library. The syntax is as follows:
%TSLIT(&macro-name)
Note: SAS macro variables are available only to FedSQL programs that are executed in a Base SAS session using PROC FEDSQL. They are not available to FedSQL programs that are executed outside the SAS System, such as on SAS Federation Server. SAS macro variables can be used to pre-process the source before it is prepared and executed. Functions like SYMPUT() and SYMGET() will not work in FedSQL.

Support for Non-Latin Characters

FedSQL supports non-Latin characters only in quoted identifiers. Only Latin characters can be used in non-delimited identifiers.
Last updated: February 23, 2017