Example documentationUSERS Locate this document in the navigation structure

 

Use of the system table DOMAIN.USERS

Prerequisites

You can use the demo data for the SQL tutorial. Start the Database Studio as database administrator MONA with the password RED and log on to demo database DEMODB: Logging On to a Database.

Define other database users. Proceed as described in SQL Tutorial, Database Users and Their Privileges.

Activities

You can use Database Studio to enter and execute SQL statements. More information: Working with SQL Statements: Overview

Note the General Instructions for formulating SQL statements.

You can use the system table USERS to determine the following database information, among other things:

  • All defined database users of the database user class STANDARD

    SELECT owner, username

    FROM DOMAIN.USERS

    WHERE usermode = 'STANDARD'

  • All database users who have not changed their passwords for more than 6 months

    SELECT username, pwcreadate, pwcreatime

    FROM DOMAIN.USERS

    WHERE pwcreadate <= subdate(date,183)

  • All database users who are allowed to log on to the database multiple times

    SELECT username, usermode

    FROM DOMAIN.USERS

    WHERE connectmode = 'MULTIPLE'

  • Name of the database on which the current database session was opened. Name of the computer on which this database is running.

    SELECT DISTINCT serverdb, servernode

    FROM DOMAIN.USERS

More Information

Currently active database user: see SESSIONS