Skip to content
Advertisement

Creating a Data Dictionary with example data (SQL)

I am looking to run a script on a SQL database to create a Data Dictionary with an example of the data for each field.

To keep it simple I would just like to include the data from the first row of each table along with each table name and column name

So something like this:

Table Name Field Name Example Data
Customer ID CU1
Customer Title Mrs
Customer Name Anne
Customer Order No ORD1

etc.

Is there an easy way to do this with a SQL script?

Advertisement

Answer

Somebody smarter than me could probably optimize this and remove the cursor but the Dynamic SQL was giving me a headache. I think in this scenario, a cursor is acceptable

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement