Documentation
Getting Started
Installation
Data Grid
Approvals
Administration
Account & Security
Integration & Staging
Architecture
Documentation/Installation/Migration from MDS

Migration from MDS

Primentra includes built-in migration wizards to import models, entities, and master data from SQL Server Master Data Services (MDS). The migration is a two-step process — always run them in this order:

  1. Models & Entities Wizard — Import the model structure (models, entities, attributes)
  2. Master Data Wizard — Import the actual data records

Requirements:

  • SQL Server 2016 or later (both wizards use FOR JSON PATH)
  • Access to the MDS database (mdm schema)
  • sqlcmd utility for data export (SSMS truncates large datasets)

What Gets Migrated

SourceWhat is imported
Models (mdm.tblModel)Name, Description, CreatedOn, UpdatedOn
Entities (mdm.tblEntity)Name, Description, CreatedOn, UpdatedOn
Attributes (mdm.tblAttribute)DisplayName, Name, DataType, MaxLength, SortOrder, IsRequired, IsCode, IsName, Description, Domain reference
Master Data (entity tables)Code, Name, all non-system attribute values, domain values

Data type mapping: Text → Text, Number → Int, Decimal → Decimal (decimal places preserved), DateTime → DateTime, Domain → Domain, Link → Text

Not migrated (by design): Change tracking, filter options, created/modified by user, business rules, derived hierarchies.

All original timestamps (CreatedOn, UpdatedOn) are preserved — the import date is not used.


Step 1: Models & Entities Wizard

Access via the gear menu → Migration Wizards → Models & Entities.

  1. Copy the SQL script from the Instructions step and save it as a .sql file (e.g. C:\Temp\export_mds_model.sql)
  2. Open PowerShell and locate sqlcmd.exe on your system using the provided command
  3. Run the sqlcmd export command (replace server, database and sqlcmd path)
  4. Upload the generated import_model.json file in the next step
sqlcmd -S server -d database -E -i export_mds_model.sql -h -1 -y 0 -Y 0 -o import_model.json

The wizard parses the JSON, shows a preview of all discovered models and entities, maps MDS data types, resolves domain attribute references, and offers per-entity conflict resolution (Skip or Overwrite). Descriptions are imported at all levels (Model, Entity, Attribute).


Step 2: Master Data Wizard

Access via the gear menu → Migration Wizards → Master Data.

  1. Copy the dynamically generated SQL query
  2. Save it as a .sql file
  3. Run via sqlcmd (not SSMS, which truncates large datasets):
sqlcmd -S server -d database -E -i export.sql -h -1 -y 0 -Y 0 -o output.ndjson
  1. Upload the output .ndjson file

The output format is NDJSON (Newline Delimited JSON) — one JSON object per line. Each line is a self-contained JSON object for one entity (or one batch of 200 rows). The wizard reassembles batches automatically.

Import actions per entity:

ActionBehavior
ImportAdd new rows, skip if Code already exists
OverwriteMatch on Code, update existing + add new
Delete + importClear all existing data, import fresh

Bulk actions are available: Import all, Overwrite all, Delete+import all. Import ordering is dependency-aware — parent entities are processed before children. Domain values are resolved from display text to internal IDs server-side.

Approval workflows are bypassed. If an entity requires approval for normal edits, the migration import still writes directly to the database. A warning is shown in the preview step for any affected entities.
Entity must exist first. Before importing data, the target entity must already exist in Primentra — created via the Model Wizard or manually in Settings → Entities. If an entity from the NDJSON file cannot be matched to an existing Primentra entity, it will show as No match in the preview and be skipped entirely during import.

Import progress:

During import, a progress overlay is displayed showing:

  • A circular animated ring with the overall percentage complete
  • An overall progress bar (e.g. "3 of 15 entities")
  • A per-entity progress bar estimated from row count
Import progress overview
Import progress overview(click to enlarge)

Cancel and rollback:

A Cancel button is available throughout the import. Pressing it stops the import after the current entity finishes — mid-entity imports are not aborted mid-stream.

When cancelled, all entities that were already imported in that session are rolled back — not just the entity being processed at the time of cancellation, but every entity imported before it as well. Rollback works by purging all rows from those entities (clearing them completely).

Example: if you cancel on entity 3 of 5, entities 1, 2, and 3 are all purged. Entities 4 and 5 are never imported.

After rollback completes, the preview screen shows a confirmation banner: "Import cancelled. Rolled back N entities." The rollback status is also shown in red in the progress overlay while it is running.

sqlcmd flags explained:

FlagPurpose
-S serverSQL Server hostname
-d databaseMDS database name
-EWindows Authentication (use -U user -P pass for SQL auth)
-i export.sqlInput file (the saved SQL script)
-h -1Suppress column headers
-y 0 -Y 0Unlimited column width (prevents truncation)
-o output.ndjsonOutput file

The Master Data wizard generates a dynamic SQL script that exports all data from your MDS entities. The script uses a cursor to iterate over all entities, builds dynamic column lists including domain resolution via LEFT JOINs, and outputs the data as batched JSON (200 rows per batch to stay under sqlcmd's 1MB output limit). Only active records are exported (WHERE Status_ID = 1).

If a domain value cannot be matched to any record in the referenced entity (by Code, Name, or {Code} Name format), the field is left empty and a warning is shown.

Ready to get started?

Start managing your master data with Primentra today.

View Pricing