SQL to ER Diagram
Home › SQL Server

SQL Server to ER Diagram

Paste your SQL Server (T-SQL) CREATE TABLE statements and get an interactive entity-relationship diagram — tables, columns, primary keys and foreign keys, drawn automatically.

Open the diagram tool →
No signup · nothing uploaded · export PNG / SVG / Mermaid / DBML · shareable link
ER diagram of the SQL Server example schema: customers and orders (2 tables, 1 relationship)
The SQL Server example below, drawn by the tool: customers and orders (2 tables, 1 relationship).

At a glance

What it is
SQL to ER Diagram is a free, open-source browser tool that turns a SQL Server schema into an interactive entity-relationship (ER) diagram.
Input
SQL Server (T-SQL) CREATE TABLE statements.
Output
An interactive ER diagram you can rearrange, then export as PNG, SVG, Mermaid, DBML or PlantUML, or share as a link.
Cost
Free. MIT-licensed open source. No account or signup.
Privacy
Runs entirely in your browser. The schema is never uploaded, and share links carry the diagram in the URL fragment, which is not sent to a server.
Limits
It never connects to your database itself: you paste schema text, or run one read-only catalog query in your own client and paste the result. There are no accounts, so there is no real-time multi-user editing; diagrams are kept in your browser, as a saved file, or as a share link. Layout stays smooth at around 300 tables.

How it works

  1. Script the schema from SSMS (right-click the database → Tasks → Generate Scripts), or copy your CREATE TABLE statements.
  2. Paste it into the editor — T-SQL is parsed automatically.
  3. Tables render with columns; FOREIGN KEY constraints become relations.
  4. Arrange, hide tables, then export PNG/SVG or share a link.

Example

A T-SQL schema like this:

CREATE TABLE customers (
  id INT IDENTITY(1,1) PRIMARY KEY,
  email NVARCHAR(255) NOT NULL UNIQUE
);

CREATE TABLE orders (
  id INT IDENTITY(1,1) PRIMARY KEY,
  customer_id INT NOT NULL,
  CONSTRAINT FK_orders_customers
    FOREIGN KEY (customer_id) REFERENCES customers(id)
);

…renders two tables with a relation from orders.customer_id → customers.id. Try it with your own →

Guide

The fastest path from SQL Server to a diagram: in SSMS, right-click the database → Tasks → Generate Scripts, choose the tables you want, and on the Scripting Options page set Script Data = False and Script Indexes = False (indexes just add noise). Paste the resulting file. The parser handles everything T-SQL-specific about that output: [dbo].[customers] bracket-quoting, IDENTITY(1,1), NVARCHAR(MAX), named CONSTRAINT FK_… blocks, and the GO batch separators.

If you prefer a query over a wizard, script the DDL yourself:

SELECT OBJECT_DEFINITION(f.object_id) FROM sys.foreign_keys f;

— or just paste your hand-written CREATE TABLE scripts; nothing needs to be pretty. Azure SQL Database and Synapse output works the same way. One tip: generate only the tables you actually want on the diagram. A 400-table ERP paste renders, but a 30-table slice of the sales schema is far more useful in a design review.

Why use it

SQL ServerT-SQLPostgreSQLMySQLSQLite

FAQ

How do I create an ER diagram from SQL Server?

In SSMS use Tasks → Generate Scripts to script the schema, then paste it here. Tables and foreign-key constraints are drawn automatically.

Is my schema uploaded anywhere?

No. Everything runs locally in your browser — your schema is never uploaded to or stored on any server.

Can I export the diagram?

Yes — export a high-resolution PNG or vector SVG, copy the schema as Mermaid, DBML or PlantUML, or share a link that encodes the whole diagram in the URL.

Is it free?

Yes. It is completely free and open source, with no account or sign-up required.

Related