How to Store Table Descriptions Directly in Your Database Using SQL Comments
Data analyst Michael Nocito published a guide on August 11, 2026, explaining how to use SQL's COMMENT ON TABLE statement to embed documentation directly into a database. Unlike inline query comments, these descriptions persist with the table, survive backups, and are readable by most BI tools and data catalogues. PostgreSQL and Oracle support the standard COMMENT ON TABLE syntax, while MySQL uses a comment clause within CREATE TABLE or ALTER TABLE statements. SQL Server takes a different approach entirely, storing descriptions as extended properties using the sp_addextendedproperty procedure with the conventional name MS_Description. Nocito argues this method is among the cheapest and most durable forms of database documentation, preventing institutional knowledge from being lost in Slack threads or spreadsheets.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in