create view Syntax

You need not specify any column names in the create clause of a view definition statement. SAP ASE gives the columns of the view the same names and datatypes as the columns referred to in the select list of the select statement.

The select list can be designated by the asterisk (*), as in the example, or it can be a full or partial list of the column names in the base tables.

See the Reference Manual: Commands.

To build views without duplicate rows, use the distinct keyword of the select statement to ensure that each row in the view is unique. However, you cannot update distinct views.

Here is a view definition statement that makes the name of a column in the view different from its name in the underlying table:

create view pub_view1 (Publisher, City, State) 
as select pub_name, city, state 
from publishers 

Here is an alternate method of creating the same view but renaming the columns in the select statement:

create view pub_view2 
as select Publisher = pub_name, 
City = city, State = state 
from publishers 

The examples of view definition statements in the next section illustrate the rest of the rules for including column names in the create clause.

Note: You cannot use local variables in view definitions.