Difference between revisions of "Useful SQL Queries for Content Manager OnDemand"

Jump to navigation Jump to search
Initial Edit: How many documents are in a Content Manager OnDemand Application Group?
m (Added section on counting documents in CMOD.)
(Initial Edit: How many documents are in a Content Manager OnDemand Application Group?)
Line 168: Line 168:


== How many documents are in an Application Group? ==
== How many documents are in an Application Group? ==
You may want to know how many documents are currently in an Application Group.  You can get this information by querying the ARSSEG table in the Content Manager OnDemand database.
This SQL Query provides the number of inserted and deleted rows from the Application Group Tables in OnDemand.
  db2 "select arsag.name,arsseg.table_name,arsseg.ins_rows,arsseg.del_rows from arsag,arsseg where arsag.agid=arsseg.agid order by arsseg.table_name"
 
  NAME                                                        TABLE_NAME        INS_ROWS    DEL_ROWS 
  ------------------------------------------------------------ ------------------ ----------- -----------
  ALPHA                                                        RQA1                      4454          0
  BRAVO                                                        RSA1                    19670          1
  CHARLIE                                                      RUA1                    18878          1
  DELTA                                                        RVA1                      153          5
  ECHO                                                        RWA1                      118          14
  FOXTROT                                                      RYA1                      7989          0
  GOLF                                                        SBA1                    195077          26
  HOTEL                                                        SDB1                    444632          0
  INDIA                                                        SIB1                      8228          0
  System Log                                                  SL10                  2500001          0
  System Log                                                  SL11                  2500000          0
  System Log                                                  SL12                  2500002          0
  System Log                                                  SL13                  2500004          0
But maybe you don't want to do the math, and instead want DB2 to count the records for you, and summarize by Application Group, instead of listing each table:
  db2 "select arsag.name,sum(arsseg.ins_rows-arsseg.del_rows) as Total_Rows from arsag,arsseg where arsag.agid=arsseg.agid group by arsag.name" 
 
  NAME                                                        TOTAL_ROWS
  ------------------------------------------------------------ -----------
  JULIET                                                          1015276
  KILO                                                              32133
  LIMA                                                              27200
  MONTREAL                                                          10726
  NANCY                                                                148
  OSCAR                                                              42072
  PAPA                                                                886
  System Log                                                    241680991


== How many documents are in the whole system? ==
== How many documents are in the whole system? ==


=== Can I export this information to a spreadsheet? ===
=== Can I export this information to a spreadsheet? ===

Navigation menu