How to export Data Classification

PROBLEM

Export Data ClassificationIn my previous post I described how Data Discovery and Classification is a half done tool.

Personally I loved it the first time saw it. But the more you use it the more you see that is very basic. At the same time I understand that Microsoft cannot keep providing software for free. So if you really need to do a proper Data Discovery and Classification you have to knock at the door of big vendors like Red-Gate or ApexSQL.

The tool is limited to what it can offer out-of-the-box which is:

  • Classify data: The idea of data discovery based on the column name is good but I needed more modular options that’s why I had to tune the query.
  • Generate Report: Is the report that you are going to show to your manager
  • Set Information Protection Policy File: You can add fields in the classification or search words through a JSON file (InformationProtectionPolicy).
  • Export Information Protection Policy File: You can export it (…you see, Microsoft, we need to export this 🙂 )
  • Reset Information Protection Policy to Default: Reset

In my case I have already classified 50 columns and I now need to export the same classification to 6 databases.

There is no way to do that.

SOLUTION

I mean, there was no way to do that till now.

I have categorized a bunch of columns on AdventureWorks in SQL Server 2019 and if I run this query the last column will print the exportation query for you:

Export Data Classification 2019

And because I’m awesome you are lucky (the project I’m working on is using SQL Server 2016 😐 ) I also have a query for SQL Server 2017 and earlier; hold your breath, this is going to be much longer: if you notice we need 4 queries in order to classify each field

CONCLUSION

Is not over, next post will be about how to export the actual data masking.

Related

Leave a Reply

Your email address will not be published. Required fields are marked *