Documentation
Getting Started
Data Grid
Modeling
Business Rules
Approvals
Users, Roles & Security
Administration
Installation
Migrating from MDS
Architecture
Documentation/Integration & API/Staging Table Structure

Staging Table Structure

The staging table holds system columns plus one column per non-system attribute. Every attribute column is NVARCHAR(MAX) — the processing engine handles type conversion and validation, not the column type.

Watch the table itself in eight minutes — every system column read out, why the attribute columns are all text, and how a batch tag lets two feeds share one table without touching each other's rows:

The Primentra staging table in SQL — columns, ImportAction and ImportStatus

System columns

ColumnTypeDescription
IdBIGINT IDENTITYAuto-generated row id
CodeNVARCHAR(200) NOT NULLThe entity code (business key) to insert, update or delete
NameNVARCHAR(500)The entity name
NewCodeNVARCHAR(255)Set this to rename a code
ImportActionTINYINTThe operation to perform (see below)
ImportStatusTINYINTProcessing status — set to 0 for new rows
BatchIdINTAssigned automatically during batch processing
BatchTagNVARCHAR(100)Optional label for grouping rows in a batch
ErrorCodeINTBitmask of error codes, set by the engine
SourceSystemNVARCHAR(100)Optional label recording where the row came from
SourceTimestampDATETIME2Optional timestamp from the source system
CreatedAtDATETIME2When the row was inserted

On an entity with Auto-generate Code, leave Code as an empty string for an insert (ImportAction 0 or 1) and one is assigned. Supply it for update, delete and rename, which match an existing record on it.

Attribute columns

One column per entity attribute, named after the attribute. Domain attributes accept the code of the target entity, not its internal id.

Inserting rows

INSERT INTO stg.Currency (Code, Name, ExchangeRate, ImportAction, ImportStatus)
VALUES ('USD', 'US Dollar', '1.0000', 0, 0);

ImportAction values

Watch each action staged and processed in six minutes — insert, update, delete and delete cascade, including why plain delete is refused when another record still points at the row:

How to insert, update and delete master data through staging in Primentra
ValueActionBehavior
0UpsertInsert if the code does not exist, update if it does (default)
1Insert onlyFail if the code already exists
2Update onlyFail if the code does not exist
3DeleteRemove the record. Refused if another entity still points at it
5Delete cascadeEmpty the fields that point at it first, then remove the record
`4` (Purge) and `6` (Purge cascade) were removed in version 1.2026.8.8. They behaved identically to 3 and 5 while the documentation described them as more forceful, so choosing one gave you something other than what it said. A row still carrying 4 or 6 is rejected with *Invalid ImportAction*, and the message names the action to use instead. Change your source system to send 3 or 5.

Delete or delete cascade

Two entities: Products and Orders. Order #77 points at product P-100. Your source system sends *"delete P-100"*.

ActionWhat happens
3 DeleteRefused. The row comes back as an error saying P-100 is still referenced. Nothing is deleted, and order #77 is untouched
5 Delete cascadeOrder #77's product field is emptied first, then P-100 is deleted. Order #77 still exists — it simply no longer has a product

Delete is the safe default. It will not let an import quietly break a link something else depends on. Reach for delete cascade when you genuinely mean *"remove this record and clear whatever pointed at it"*.

There is deliberately no third option that deletes the record and leaves order #77 pointing at something that no longer exists. That pushes the problem into a report weeks later, where the cause is nearly impossible to find.

ImportStatus values

ValueMeaningWhen set
0ReadySet by the external system. Only rows with status 0 are picked up
1OKSet by the engine after successful processing
2ErrorSet by the engine when processing fails. Check ErrorCode
3ProcessingSet briefly during batch execution
Always set ImportStatus = 0 when inserting new rows. The engine ignores rows with any other status.

Domain attributes

For a column that references another entity, insert the code of the target record:

INSERT INTO stg.Invoice (Code, Name, Currency, ImportAction, ImportStatus)
VALUES ('INV-001', 'January Invoice', 'EUR', 0, 0);

The engine resolves 'EUR' to the internal Currency row id. If the code does not exist, the row fails with error code 8192 (Domain value not found).

Renaming a code

Use the NewCode column to change an entity's business key:

INSERT INTO stg.Currency (Code, NewCode, ImportAction, ImportStatus)
VALUES ('USD', 'US-DOLLAR', 2, 0);

This updates the existing USD row's code to US-DOLLAR. The engine checks that NewCode does not already exist in production, and that no two rows in the same batch carry the same NewCode.

Ready to get started?

Start managing your master data with Primentra today.

View Pricing
Staging Table Structure | Integration & API | Docs | Primentra