Bob Stearns wrote:
Linux accepts the userid '00001', and I can login to my database with
that userid. But when I try to grant privileges to that userid I get:
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC:
00001;user_animals TO USER;END-OF-STATEMENT
Message: An unexpected token "00001" was found following "user_animals
TO USER". Expected tokens may include: "END-OF-STATEMENT".
The grant statement is:
GRANT SELECT ON TABLE is3.user_animals TO USER 00001
The example in the SQL Reference Vol 2 is:
GRANT SELECT, INSERT ON CALENDAR TO USER PHIL, USER CLAIRE
TABLE is optional, I include for clarity. I an trying to grant only
SELECT to only USER 00001, so I think my general syntax is OK. My
question is:
Does db2 disallow purely numeric userids?
From the Administration Guide - Implementation:
General naming rules
7 Rules exist for the naming of all objects and *** users***. 7 Some of
these rules are specific to the platform you are working on. 7 For
example, there is a rule regarding the use of upper and lower case
letters in a name.
* On UNIX(R) platforms, names must be in lower case.
* On Windows(R) platforms, names can be in upper, lower, and
mixed-case.
Unless otherwise specified, all names can include the following characters:
* A through Z. When used in most names, characters A through Z are
converted from lowercase to uppercase.
* 0 through 9.
* 7 ! % ( ) { } . - ^ ~ _ (underscore) 7 @, #, $, and space.
* 7 \ (backslash).
---------------------------------------------------------------------
Names cannot begin with a number or with the underscore character.
---------------------------------------------------------------------
*** This means the userids that db2 likes CANNOT begin with a number......
Do not use SQL reserved words to name tables, views, columns, indexes,
or authorization IDs.
7 There are other special characters that might work separately
depending 7 on your operating system and where you are working with
DB2(R) Universal Database (DB2 UDB). 7 However, while they might work,
there is no guarantee that they will work. 7 It is not recommended that
you use these other special characters when naming objects in your database.
You also need to consider object naming rules, workstation naming rules,
naming rules in an NLS environment, and naming rules in a Unicode
environment.
Related concepts