79134188

Date: 2024-10-28 16:08:02
Score: 3
Natty:
Report link

How do I identify if a table is partitioned?

SELECT 
  TABLE_NAME, 
  TABLE_SCHEMA, 
  PARTITION_TABLE 
FROM 
  QSYS2.SYSTABLES
WHERE 
  TABLE_SCHEMA = 'YOUR_SCHEMA' 
  AND
  TABLE_NAME = 'YOUR_TABLE';

How do I find out the number of partitions of a Table?

SELECT 
  count(*) as NUM_PARTITIONS
FROM 
  QSYS2.SYSPARTITIONDISK
WHERE 
  TABLE_SCHEMA = 'YOUR_SCHEMA' 
  AND
  TABLE_NAME = 'YOUR_TABLE';

How do I Write a Query to retrieve data from a Specific partition by providing a partition name or number reference?

SELECT A.*
FROM YOUR_TABLE A
WHERE DATAPARTITIONNAME(A) = 'PARTITION_NAME';
Reasons:
  • Blacklisted phrase (1): How do I
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): How do I
  • Low reputation (0.5):
Posted by: Justus Kenklies