Creates precomputed result sets and the policies required to maintain them.
create {precomputed result set | materialized view} [owner_name.]prs_name [(alternative_column_name [[constraint constraint_name] unique (column_name,...)] [{immediate | manual} refresh] [{populate | nopopulate}] [enable | disable] [{enable | disable} use in optimization] [lock { datarows | datapages | allpages}] [on segment_name] [partition_clause] as query_expression
specifies an encrypted column.
keyname – identifies a key created using create encryption key. The table owner must have select permission on keyname. If keyname is not supplied, the server looks for a default key created using create encryption key or alter encryption key.
decrypt_default – specifies that this column returns a default value for users who do not have decrypt permissions.
See “Encrypting Data,” in the Encrypted Columns Users Guide for a list of supported datatypes.
If you do not specify the name for a unique or primary-key constraint, the SAP ASE server generates a name in the format tabname_colname_tabindid, where tabindid is a string concatenation of the table ID and index ID.
immediate – (default) updates the precomputed result set during the same transaction that updates the base tables.
manual – explicitly updates the precomputed result set. When you use the manual parameter, updates to the base tables are not reflected in the precomputed result set until you explicitly issue refresh. Because manual precomputed result sets are not maintained, the SAP ASE server considers them to be stale, even after you issue the refresh parameter. Therefore, the query processor selects this data for query rewrite only if the query accepts stale data.
populate – (default) result set is populated as part of the create command.
nonpopulate – result set is not populated as part of the create command. If you specify nonpopulate, you cannot run the enable parameter on the precomputed result set. The SAP ASE server enables the precomputed result set the next time you issue the refresh command.
enable – (default) is available for operations. Only precomputed result sets configured for enable are maintained according to their refresh policy.
Used for the query rewrite during optimization, whether or not you specify use in optimization.
Populated, whether or not you specify with populate.
immediate – is considered for all queries.
manual – is considered only if the query accepts with stale data.
create precomputed result set prs_1 as select col1, col2 from test_tab1e
set ansinull on
set arithabort on
set arithignore off
set string_rtruncation on
You cannot include a like clause with create precomputed result sets or create materialized view that includes an immediate refresh parameter.
The create precomputed result set command is a Transact-SQL extension and is not covered by the SQL standard.
You must have create table and create view privileges to create precomputed result sets.
Creating precomputed result sets is not audited.