draft

SQL Server schema diagrams from a scripted database

Bracketed identifiers, bracketed type names and clustered primary keys with a sort direction, read the way SSMS scripts them.

Open the app

What the parser makes of it

The diagram

Customer CustomerId int PK FirstName nvarchar(40) Email nvarchar(60) SupportRepId int Invoice InvoiceId int PK CustomerId int FK BillingAddress nvarchar(70) Total numeric(10,2)
Drawn from the file below by draft render, on this page's build.

The file

This is the project's SQL Server test fixture, in full and unedited. Everything above was produced from it.

/* SQL Server: bracketed identifiers everywhere, including the types, and
   PRIMARY KEY CLUSTERED with a sort direction inside the column list. */

CREATE TABLE [dbo].[Customer](
    [CustomerId] [int] IDENTITY(1,1) NOT NULL,
    [FirstName] [nvarchar](40) NOT NULL,
    [Email] [nvarchar](60) NULL,
    [SupportRepId] [int] NULL,
 CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED ([CustomerId] ASC)
);

CREATE TABLE [dbo].[Invoice](
    [InvoiceId] [int] IDENTITY(1,1) NOT NULL,
    [CustomerId] [int] NOT NULL,
    [BillingAddress] [nvarchar](70) NULL,
    [Total] [numeric](10, 2) NOT NULL,
 CONSTRAINT [PK_Invoice] PRIMARY KEY CLUSTERED ([InvoiceId] ASC)
);

ALTER TABLE [dbo].[Invoice] ADD CONSTRAINT [FK_InvoiceCustomer]
    FOREIGN KEY([CustomerId]) REFERENCES [dbo].[Customer] ([CustomerId]);