Try OpenEdge Now
skip to main content
Multi-tenancy Overview
Multi-tenancy and OpenEdge SQL : Super tenant use cases : Move rows between partitions in a multi-tenant table
 

Move rows between partitions in a multi-tenant table

To move the rows from the DEFAULT partition of a multi-tenant table, mtcustomer, and distribute it to the tenants, SNCSoftware and OEDProducts:
INSERT INTO pub.mtcustomer TENANT SNCSoftware
SELECT *
FROM pub.mtcustomer AS mtc
WHERE tenantName_tbl (mtc) = 'default'
AND MOD (custnum, 2) = 0;

INSERT INTO pub.mtcustomer TENANT OEDProducts
SELECT *
FROM pub.mtcustomer AS mtc
WHERE tenantName_tbl (mtc) = 'default'
AND MOD (custnum, 2) <> 0;

DELETE
FROM pub.mtcustomer AS mtc
WHERE tenantName_tbl (mtc) = 'default';