April 2009
This script is an update of ScriptDiagram2005. The 'old' version does work with SQL Server 2008, however this new version is slightly easier to use since it has no external dependencies. You should read the earlier doco for a brief history of the the script (and it's origins in Clay Beatty's SQL Server 2000 version).
ScriptDiagram2008
ScriptDiagram2008 allows you to 'extract' the binary data from dbo.sysdiagrams into a text format that can be saved to disk and added to source control. It saves the data in the form of INSERT statements that re-create the diagram's binary data directly into dbo.[sysdiagrams]
You can read about the previous version here - the 2008 update is limited to the removal of the Varbinarytovarchar() user-defined-function, replaced with a built-in (but undocumented?) SQL Server function sys.fn_varbintohexstr() (thanks to f).
sys.fn_varbintohexstr()
sys.diagrams
EXEC Tool_ScriptDiagram2008 'AllTables' produces output in the Messages window, which is in fact an SQL script itself (ie. code generation!)
EXEC Tool_ScriptDiagram2008 'AllTables'
If the script failed to run successfully it will print an error message.