Convert a SQL Server schema to Amazon Redshift
Paste the CREATE TABLE statements from SQL Server and ERD Designer draws them as a diagram. Change the diagram's target database to Amazon Redshift and every column's datatype is converted. You review each change before it is applied, then generate the Amazon Redshift script.
What changes in the sample
Converted to Amazon Redshift, these columns of the sample above change type. Everything else keeps its type; names, keys, nullability and lists of allowed values are left as they are.
| Column | SQL Server | Amazon Redshift | Note |
|---|---|---|---|
Customers.CustomerId | INT identity | BIGINT | |
Customers.Email | NVARCHAR(255) | CHARACTER VARYING(255) | |
Customers.FullName | NVARCHAR(120) | CHARACTER VARYING(120) | |
Customers.Notes | NVARCHAR(MAX) | CHARACTER VARYING | |
Customers.IsActive | BIT | BOOLEAN | default: 1 → TRUE |
Customers.CreatedAt | DATETIME2(7) | TIMESTAMP | default: SYSUTCDATETIME() → CURRENT_TIMESTAMP |
Orders.OrderId | BIGINT identity | BIGINT | |
Orders.CustomerId | INT | BIGINT | |
Orders.PublicId | UNIQUEIDENTIFIER | CHARACTER VARYING(36) | default: NEWID() removed |
Orders.PlacedAt | DATETIMEOFFSET(3) | TIMESTAMPTZ | |
Orders.ReceiptPdf | VARBINARY(MAX) | CHARACTER VARYING |
What it tells you
Where a conversion loses something, ERD Designer says so rather than picking for you. These are the messages for the sample:
- Customers.CustomerId: Amazon Redshift will not number new rows for this key — it is a plain BIGINT. Number it by hand, or add the database's own auto-numbering after generating.
- Customers.CreatedAt: Amazon Redshift timestamps take no fractional-second precision — "(7)" was dropped.
- Customers.CreatedAt: default SYSUTCDATETIME() is the time in UTC; it became CURRENT_TIMESTAMP, which is the session's local time — the same only where the database runs in UTC.
- Orders.OrderId: Amazon Redshift will not number new rows for this key — it is a plain BIGINT. Number it by hand, or add the database's own auto-numbering after generating.
- Orders.PublicId: Amazon Redshift has no function this engine writes that generates a UUID — default NEWID() removed; generate the values in your application.
- Orders.PlacedAt: Amazon Redshift timestamps take no fractional-second precision — "(3)" was dropped.
- Redshift does not support indexes, so none was created for: Orders (PlacedAt).
The Amazon Redshift script
This is what ERD Designer generates for the sample, for Amazon Redshift. Our test suite applies this conversion to a real Amazon Redshift server and then reads the database back to confirm it matches the diagram exactly.
-- NOTE: Redshift does not enforce PRIMARY KEY, UNIQUE or FOREIGN KEY.
-- They are declared for the query planner, which TRUSTS them: a key that is
-- not actually unique will produce wrong results rather than an error.
-- Create table Customers
CREATE TABLE "Customers" (
"CustomerId" BIGINT NOT NULL,
"Email" VARCHAR(255) NOT NULL,
"FullName" VARCHAR(120) NOT NULL,
"Notes" VARCHAR(256),
"IsActive" BOOLEAN NOT NULL DEFAULT TRUE,
"CreatedAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Customers_PK" PRIMARY KEY ("CustomerId")
)
DISTSTYLE AUTO;
-- Create table Orders
CREATE TABLE "Orders" (
"OrderId" BIGINT NOT NULL,
"CustomerId" BIGINT NOT NULL,
"PublicId" VARCHAR(36) NOT NULL,
"Total" NUMERIC(12,2) NOT NULL,
"PlacedAt" TIMESTAMPTZ NOT NULL,
"ReceiptPdf" VARCHAR(256),
CONSTRAINT "Orders_PK" PRIMARY KEY ("OrderId")
)
DISTSTYLE AUTO;
-- Add unique constraint on Customers (Email)
ALTER TABLE "Customers" ADD CONSTRAINT "Customers_UQ1" UNIQUE ("Email");
-- Add foreign key Orders (CustomerId) → Customers (CustomerId)
ALTER TABLE "Orders" ADD CONSTRAINT "Orders_FK1" FOREIGN KEY ("CustomerId") REFERENCES "Customers" ("CustomerId");
How to convert your own schema
- Paste your SQL Server script above and press Open in ERD Designer. The diagram opens laid out and ready to edit.
- Click the diagram's name in the toolbar to open its properties, choose Amazon Redshift under Target Database / Version, and press Apply Changes.
- If Amazon Redshift offers more than one way to store a kind of column, choose one and press Continue.
- Read the list of retyped columns and any warnings, then press Apply Conversion. Save the diagram to keep it.
- Press Generate DDL (the database icon) to copy or download the Amazon Redshift script — or apply it to a database on your own network with the ERD Designer Agent.
What it reads, and what it does not
- It reads
CREATE TABLE,ALTER TABLE … ADD CONSTRAINTandCREATE INDEX: tables, columns, keys, foreign keys, unique constraints, check lists and indexes. Anything else in the script is skipped and listed. - It converts the schema, never the data: no rows are read, moved or changed.
- It does not convert views, stored procedures, functions, triggers or packages.
Which plan you need
Pasting a script and working with it as a diagram is free on the Basic plan, with no card. Converting a diagram to another database is part of the Pro and Advanced plans, which also generate its script and can apply it through the Agent.
Other conversions
- SQL Server to PostgreSQL
- SQL Server to Oracle
- SQL Server to MySQL
- SQL Server to MariaDB
- SQL Server to SQLite
- SQL Server to Google BigQuery
- SQL Server to Snowflake
- PostgreSQL to Amazon Redshift
- Oracle to Amazon Redshift
- MySQL to Amazon Redshift
- MariaDB to Amazon Redshift
- SQLite to Amazon Redshift
- Google BigQuery to Amazon Redshift
- Snowflake to Amazon Redshift
Questions? Write to support@erddesigner.com. · ERD Designer · Terms · Privacy