Creates a new view.
Transact-SQL Syntax
create view [owner.]view_name [(column_name [, column_name]...)] as select [distinct] select_statement [with check option]
ODBC Syntax
CREATE VIEW viewed_table_name
[(column_identifier[,column_identifier]...)]
AS query_specification
begins the select statement that defines the view.
specifies that the view cannot contain duplicate rows (optional).
indicates that all data modification statements are validated against the view selection criteria. All rows inserted or updated through the view must remain visible through the view.
is the name of the view. The view name cannot include the database name. It must conform to the rules for identifiers.
is the name of the column in the view. It must conform to the rules for identifiers.
completes the select statement that defines the view. It can include more than one table and other views.
create view “new view” (“column 1”, “column 2”) as select col1, col2 from “old view”
In this example, the new view is created from the old view.Both columns are renamed in the new view. All view and column names that include embedded blanks are enclosed in double quotation marks. Before creating the view, you must set the quoted_identifier property to on.
You can use views as security mechanisms by granting authorization on a view but not on its underlying tables.
The with check option is removed from the transformed SQL text.