Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Data Types and Expressions > Expression >

USER Operator

The USER operator returns a string containing the login name (also called the authorization identifier) of the current user who is running the process.

The following statements show how you might use the USER operator:

INSERT INTO cust_calls VALUES 
   (221,CURRENT,USER,'B','Decimal point off', NULL, NULL)

SELECT * FROM cust_calls WHERE user_id = USER

UPDATE cust_calls SET user_id = USER WHERE customer_num = 220

The USER operator does not change the lettercase of a user ID. If you use USER in an expression and the current user is Robertm, the USER operator returns Robertm, not robertm or ROBERTM.

If you specify USER as a default column value, column must be of type CHAR, VARCHAR, NCHAR, NVARCHAR, or (in Dynamic Server) LVARCHAR.

If you specify USER as the default value for a column, the size of column should not be less than 32 bytes. You risk getting an error during operations such as INSERT or ALTER TABLE if the column length is too small to store the default value.

In an ANSI-compliant database, if you do not enclose the owner name in quotes, the name of the table owner is stored as uppercase letters. If you use the USER operator as part of a condition, you must be sure that the way the user name is stored matches what the USER operator returns with respect to lettercase.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]