Gagal Simpan Schema di MS-SQLServer 2012

26 November 2016

Yang pernah/sedang mengalami gagal simpan schema pada Microsoft SQLServer 2012, dengan pesan error seperti ini:

TITLE: Microsoft SQL Server Management Studio

Cannot insert the value NULL into column 'diagram_id', table 'MONAS_ALS.dbo.sysdiagrams'; column does not allow nulls. INSERT fails.

The statement has been terminated.

The 'sp_creatediagram' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead. (.Net SqlClient Data Provider)

Berikur solusi untuk mengobatinya:

DROP TABLE dbo.sysdiagrams;
GO
CREATE TABLE [dbo].[sysdiagrams]
(
 [name] [sysname] NOT NULL,
 [principal_id] [int] NOT NULL,
 [diagram_id] [int] IDENTITY(1,1) PRIMARY KEY,
 [version] [int] NULL,
 [definition] [varbinary](max) NULL,
 CONSTRAINT [UK_principal_name] UNIQUE ([principal_id],[name])
);

GO
EXEC sys.sp_addextendedproperty 
 @name=N'microsoft_database_tools_support', 
 @value=1 , 
 @level0type=N'SCHEMA',
 @level0name=N'dbo', 
 @level1type=N'TABLE',
 @level1name=N'sysdiagrams';
GO

Semoga bermanfaat 🙂

Tidak ada Komentar

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

This site uses Akismet to reduce spam. Learn how your comment data is processed.