SQL Server: Create Database Diagram On-demand
The chart functionality is fully contained in Management Studio, and its internal API is undocumented. All charts are stored as VARBINARY(MAX)
blobs in sysdiagrams
, and the table and associated stored procedures are only created after you have granted SSMS permission to do so. The format of the chart blocks is also undocumented, but in case you're wondering, it's not something easy to reverse engineer like an XML document, and also non-stored procedures don't touch the internal structure of the blob so you can't learn anything from that ... Even if you redesigned it, future versions of Management Studio may invalidate your results (the format was previously updated).
I'm going to go no, this is not possible for non-Management Studio developers. "If you want to programmatically create and maintain database diagrams (other than renaming or deleting them), Management Studio's built-in functionality is not suitable. Use one of the many tools for charts.
source to share