The database name is an identifier, and the table name is also an identifier. in SQL Server, there are two types of identifiers:
There are two types of identifiers:
Regular identifier
Complies with the format rules of identifiers. Do not separate regular identifiers in a Transact-SQL statement.
Select * From tablexwhere keycol = 124
Separator
Enclosed in double quotation marks (") or square brackets. Identifiers that comply with the identifier format rules can be separated or not separated.
Select * from [tablex] -- Delimiter is optional. Where [keycol] = 124 -- Delimiter is optional.
In a Transact-SQL statement, identifiers that do not comply with the rules of all identifiers must be separated.
Select * from [my table] -- identifier contains a space and uses a reserved keyword. Where [order] = 10 -- identifier is a reserved keyword.
The regular and delimiter identifiers must contain 1 to 128 characters. For a local temporary table, the identifier can contain a maximum of 116 characters.
The important difference between the two is that regular identifiers must strictly abide by naming rules, while separated identifiers can not comply with naming rules, as long as they are separated.
identifier format:
1. The identifier must be a character specified in the Unicode 2.0 standard and a number of other language characters. Such as Chinese characters.
2. The characters after the identifier can be (except for condition 1) "_", "@", "#", "$", and numbers.
3. The identifier cannot be a reserved word of transact-SQL.
4. Empty and special characters are not allowed in the identifier.
In addition, some identifiers starting with special characters have specific meanings in SQL Server. For example, the identifier starting with "@" indicates that this is a local variable or a function parameter; the identifier starting with "#" indicates that this is a temporary table or a stored procedure. Starting with "#" indicates that this is a global temporary database object. The global variables of transact-SQL start. An identifier can contain up to 128 characters.