Computed columns example  Computed columns and function-based indexes syntax changes

Chapter 8: Creating Databases and Tables

Indexes on computed columns

You can create indexes on computed columns as though they were regular columns, as long as the datatype of the result can be indexed. Computed column indexes and function-based indexes provide a way to create indexes on complex datatypes like XML, text, unitext, image, and Java classes.

For example, the following code sample creates a clustered index on the computed columns as though they were regular columns:

CREATE CLUSTERED INDEX name_index on part_table(name_order)
CREATE INDEX adt_index on parts_table(version_order)
CREATE INDEX xml_index on parts_table(spec_index)
CREATE INDEX text_index on parts_table(descr_index)

Adaptive Server evaluates the computed columns and uses the results to build or update indexes when you create or update an index.





Copyright © 2005. Sybase Inc. All rights reserved. Computed columns and function-based indexes syntax changes

View this book as PDF