dbInit_db2.sql 935 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. -- Licensed Materials - Property of IBM
  2. -- IBM Cognos Products: camaaa
  3. -- (C) Copyright IBM Corp. 2011, 2012
  4. -- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  5. create table USERS (
  6. USERID integer not null ,
  7. USERNAME varchar(255) not null ,
  8. PASSWORD varchar(255) not null ,
  9. FULLNAME varchar(255) ,
  10. EMAIL varchar(255) ,
  11. LOCALE char(5) ,
  12. TENANT varchar(128) ,
  13. constraint PK_USERS primary key (USERID)
  14. );
  15. create table GROUPS (
  16. GROUPID integer not null,
  17. GROUPNAME varchar(255) NOT NULL,
  18. USERID integer,
  19. TENANT varchar(128) not null
  20. );
  21. create view OBJECTVIEW
  22. as
  23. select
  24. USERID as ID,
  25. USERNAME as USERNAME,
  26. FULLNAME as NAME,
  27. TENANT as TENANT,
  28. 1 as ISUSER,
  29. 0 as ISGROUP
  30. from USERS
  31. union
  32. select
  33. GROUPID as ID,
  34. NULL as USERNAME,
  35. GROUPNAME as NAME,
  36. TENANT as TENANT,
  37. 0 as ISUSER,
  38. 1 as ISGROUP
  39. from GROUPS;