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

Jump to navigation Jump to search
Added section on exporting Content Manager OnDemand Application Group row counts to Comma Delimited Format.
(Initial Edit: How many documents are in a Content Manager OnDemand Application Group?)
(Added section on exporting Content Manager OnDemand Application Group row counts to Comma Delimited Format.)
Line 167: Line 167:
The values on the left (from the ARSAG table) are repeated, because the values (AGIDs 5007 and 5001) appear multiple times in the ARSAPP table.  Notice that Applications have their own unique identifiers as well, separate from AGIDs.
The values on the left (from the ARSAG table) are repeated, because the values (AGIDs 5007 and 5001) appear multiple times in the ARSAPP table.  Notice that Applications have their own unique identifiers as well, separate from AGIDs.


== How many documents are in an Application Group? ==
== How many documents are in CMOD Application Groups? ==


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.
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.
Line 206: Line 206:
   System Log                                                    241680991
   System Log                                                    241680991


== How many documents are in the whole system? ==
=== Can I export this information to a spreadsheet? ===
 
Yup!  Prefix your select statement with an export command, specifying the "Delimited" format, which uses commas (",") by default:
 
  db2 "export to AG_Row_Count.csv of DEL 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"
 
  SQL3104N  The Export utility is beginning to export data to file "AG_Row_Count.csv".
  SQL3105N  The Export utility has finished exporting "205" rows.
 
  Number of rows exported: 205
 
Now let's check the results:


=== Can I export this information to a spreadsheet? ===
  $ ls -l AG_Row_Count.csv
  -rw-r--r--    1 archive  sysadm1        3847 Jul 05 09:52 AG_Row_Count.csv
 
  $ more AG_Row_Count.csv
  "QUEBEC",6198
  "ROMEO",12971
  "SIERRA",23032
  "TANGO",18902
  "UNIFORM",38344
  "VICTOR",56579

Navigation menu