close up shot of colorful shapes on the white table
Photo by Mikhail Nilov on Pexels.com

Quickly Reorder MDS Attributes Using SQL Updates

If you’ve ever used Microsoft Master Data Services (MDS), you’ve probably noticed one of its more annoying limitations: there’s no drag-and-drop interface to reorder attributes within an entity. Want to move 10 attributes from the bottom of a 100-column entity to the top? Get ready to click hundreds of times on those tiny arrow buttons in the UI — one position at a time.

It’s painful. It’s slow. It makes you want to give up halfway and live with a messy data model.

But here’s the good news:

You can do this directly in the database with a quick SQL update — much faster and more controlled.


🧩 The Problem

By default, MDS stores the display order of attributes in the table mdm.tblAttribute, in the column called SortOrder. However, changing that value in the database does not immediately reflect in the MDS web interface, unless you refresh the model’s metadata cache.

Let’s walk through how to move a block of attributes from one position to another — without the endless clicking.


🎯 The Scenario

Say you have an entity with 100 attributes, and you want to move the last 10 (IDs 1668–1675) right after attribute ID 626, which currently has a SortOrder of 18. Here’s how to do it.


⚙️ Step 1: Shift existing SortOrders to make room

We’re going to bump everything after SortOrder 18 up by 8, to make space for our new block.

UPDATE a
SET a.SortOrder = a.SortOrder + 8
FROM mdm.tblAttribute a
WHERE a.Entity_ID=33
AND a.SortOrder>18

⚙️ Step 2: Assign new SortOrders to your selected attributes

We now insert our 8 attributes into the newly freed-up SortOrder slots (19–26):

UPDATE mdm.tblAttribute SET SortOrder = 19 WHERE ID = 1668;
UPDATE mdm.tblAttribute SET SortOrder = 20 WHERE ID = 1669;
UPDATE mdm.tblAttribute SET SortOrder = 21 WHERE ID = 1670;
UPDATE mdm.tblAttribute SET SortOrder = 22 WHERE ID = 1671;
UPDATE mdm.tblAttribute SET SortOrder = 23 WHERE ID = 1672;
UPDATE mdm.tblAttribute SET SortOrder = 24 WHERE ID = 1673;
UPDATE mdm.tblAttribute SET SortOrder = 25 WHERE ID = 1674;
UPDATE mdm.tblAttribute SET SortOrder = 26 WHERE ID = 1675;

🔄 Step 3: Force MDS to recognize the new order

Now here’s the catch: MDS caches metadata, so even though the database is updated, the UI might not reflect your changes. You can force MDS to rebuild by doing one of the following:

Option A: Add and remove a dummy attribute

This is the simplest workaround:

  1. Go to System Administration > Manage Entity.
  2. Add a new dummy attribute.
  3. Save.
  4. Delete the dummy attribute again.

This will trigger a metadata refresh and your new attribute order will show up.

Option B (cleaner): Export and redeploy the model

Use MDSModelDeploy.exe to export and re-import your model:

MDSModelDeploy.exe exportmdl -model "YourModelName" -version "VERSION_1" -package "yourmodel.pkg"
MDSModelDeploy.exe deployclone -package "yourmodel.pkg" -model "YourModelName" -version "VERSION_CLONE"

This rebuilds the internal structure and re-applies the correct attribute order.


✅ Final Result

With this approach:

  • You control exactly where attributes appear.
  • You avoid manually clicking 100+ times.
  • You reduce the risk of human error in complex models.

Check Also

Claude inzetten voor het schrijven van SQL-queries: zegen of valkuil?

De afgelopen jaren zijn Large Language Models (LLM’s) zoals GPT van OpenAI en Claude van …

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *