How to Create a View in SQL Server

Last updated July 25, 2026 · By the SaturnSQL team

Use CREATE OR ALTER VIEW ... AS SELECT (SQL Server 2016 SP1+), which creates the view or replaces its definition while keeping permissions. CREATE VIEW must be the first statement in its batch.

CREATE OR ALTER VIEW active_customers AS
SELECT id, email, last_seen_at
FROM customers
WHERE churned = 0;

Views run their SELECT at query time. If that is too slow, an indexed view (created WITH SCHEMABINDING plus a unique clustered index) materializes the result, at the cost of restrictions on the SELECT and write overhead on the base tables.

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related SQL Server guides

© 2026 Panda Capital Oy Ab. All rights reserved.