Cannot insert the value null into column ‘diagram_id’, table dbo.sysdiagrams

When ever I copy the database from the production server to the development machine the database throws an error when updating a database diagram or creating a new database diagram. The error in question is

cannot-insert-the-value-null-into-column-diagram_id

The solution to this problem is rather simple go to dbo.sysdiagram table and set change the diagram_id default value to 0. However when you right click to bring up the design window for the dbo.sysdiagram table the option is disabled.
cannot-edit-table

Open up the columns and right click on the diagram_id column and select modify
edit_table

This loads the sysdiagram design window from where you can set the default value of the diagram_id field

setdefaultvalue

Save the changes and you will be able to update existing database diagrams and create new database diagrams.

Note this solution may not work for ever and has only been tested on sql server 2005.

Source: Link

1 thought on “Cannot insert the value null into column ‘diagram_id’, table dbo.sysdiagrams

Leave a Comment