Thursday 31 December 2009

Computed Columns / Functional Indexes ASE 15 Practicals

4 tables are created :
All tables contain 3 base columns num1, num2, num3
table_computed extra computed column ( num1 + num2 + num3 ) materialized
table_computed_nmz extra computed column ( num1 + num2 + num3 ) virtual
table_function extra computed column ( num1 + num2 + num3 ) materialized
table_function_nmz extra computed column ( num1 + num2 + num3 ) virtual

1> use sag
1> create nonclustered index table_computed_nci on table_computed(colcomp)
2>
1>
1> create nonclustered index table_computed_nmz_nci on table_computed_nmz(colcomp)
2>
Msg 1777, Level 16, State 1:
Server 'GALLARDO', Line 1:
Cannot create index on a virtual computed column (colcomp). Modify it to materialized using the ALTER TABLE MODIFY commmand first and retry.
1> create table table_function
2> (


1> create nonclustered index table_function_nmz_nci on table_function_nmz(compcol*5/4)
2>
Msg 11062, Level 16, State 1:
Server 'GALLARDO', Line 1:
Column 'compcol' is a computed column. Only regular columns can be referenced in a computed column (or function-based index key) definition.
1> create nonclustered index table_function_nmz_nci on table_function_nmz(num1*compcol*5/4)
2>
Msg 11062, Level 16, State 1:
Server 'GALLARDO', Line 1:
Column 'compcol' is a computed column. Only regular columns can be referenced in a computed column (or function-based index key) definition.
1> create nonclustered index table_function_nci on table_function(num1*compcol*5/4)
2>
Msg 11062, Level 16, State 1:
Server 'GALLARDO', Line 1:
Column 'compcol' is a computed column. Only regular columns can be referenced in a computed column (or function-based index key) definition.
1> create nonclustered index table_function_nci on table_function(num1*num2)
2>
Msg 11052, Level 16, State 1:
Server 'GALLARDO', Line 1:
The 'select into' database option is not enabled for database 'sag'. ALTER TABLE with data copy cannot be done. Set the 'select into' database option and re-run.
1> use master
2>
1> sp_dboption sag,'select', true
2>
Database option 'select into/bulkcopy/pllsort' turned ON for database 'sag'.
Running CHECKPOINT on database 'sag' for option 'select into/bulkcopy/pllsort' to take effect.
(return status = 0)
1> use sag
2> checkpoint
3>
1> create nonclustered index table_function_nci on table_function(num1*num2)
2>
(442 rows affected)
1> create nonclustered index table_function_nci_nmz on table_function_nmz(num1*num2)
2>
(492 rows affected)
1> create clustered index table_function_ci on table_function(num1*num2*num3)
2>
Msg 1948, Level 16, State 1:
Server 'GALLARDO', Line 1:
Clustered function-based index is not supported.
1> create clustered index table_computed_ci on table_computed(colcomp)
2>
Non-clustered index (index id = 2) is being rebuilt.

No comments:

Post a Comment