SET SQL DIALECT 3;




CREATE DOMAIN BOOL AS
SMALLINT
NOT NULL
CHECK (value=1 or value=0 or value is null);

CREATE TABLE Users
(
    PKID                        CHAR(16) CHARACTER SET OCTETS NOT NULL PRIMARY KEY,
    USERNAME                    VARCHAR(255) character set UNICODE_FSS NOT NULL,
    APPLICATIONNAME             VARCHAR(255) character set UNICODE_FSS NOT NULL,
    EMAIL                       VARCHAR(128) character set UNICODE_FSS NOT NULL,
    COMMENT                     VARCHAR(255) character set UNICODE_FSS,
    USERPASSWORD                VARCHAR(128) character set UNICODE_FSS NOT NULL,
    PASSWORDQUESTION            VARCHAR(255) character set UNICODE_FSS,
    PASSWORDANSWER              VARCHAR(255) character set UNICODE_FSS,
    ISAPPROVED                  BOOL,
    LASTACTIVITYDATE            TIMESTAMP,
    LASTLOGINDATE               TIMESTAMP,
    LASTPASSWORDCHANGEDDATE     TIMESTAMP,
    CREATIONDATE                TIMESTAMP,
    ISONLINE                    BOOL,
    ISLOCKEDOUT                 BOOL,
    LASTLOCKEDOUTDATE           TIMESTAMP,
    FAILEDPASSWORDATTEMPTCOUNT  INTEGER,
    FAILEDPASSWORDATTEMPTSTART  TIMESTAMP,
    FAILEDPASSWORDANSWERCOUNT   INTEGER,
    FAILEDPASSWORDANSWERSTART   TIMESTAMP
)
