|
index_colorder()
The
System Function
index_colorder()
returns the sort order of the
columns
defined in an
index.
Depending on the order in which columns are sorted, the return value can be
ASC for ascending or DESC for descending.
Syntax of the System Function index_colorder()
index_colorder(object_name, index_id, key_number [, user_id])
The parameters of the System Function index_colorder()
"object_name"
The parameter "object_name" is the name of the
object,
in this case of a
table
or a
view
in a
database.
The object_name is stored in
column
"name" of the
system table
sysobjects.
The parameter "object_name"
must be set in quotes. Additionally, the fully qualified name can be used, referencing
the
Datenbank
and the object owner. If the value specified for the parameter
"object_name" is not a table, the return value is
NULL.
"index_id"
The parameter "index_id" is the number of an
object,
belonging to the object referenced in the parameter "object_name".
The "index_id" is stored in the
column
"indid" in the
system table
sysindexes.
"key_number"
The parameter "key_number" is specifies a "key" of an
index.
This
value
for a
clustered index
ranges between 1 and the value stored in the
column
"keycnt" of the
system table
sysindexes.
For a
nonclustered index
this value ranges between 1 and the value stored in the column
"keycnt"+1 of the system table sysindexes. If the specified value for the parameter
"key_number" is not a number of a valid key, the return value will be
NULL.
"user_id"
The parameter "user_id" is the identification number of the owner of the object.
If the parameter "user_id" is not specified, the id of the currently executing user
will be taken as default.
Example for the System Function index_colorder()
select name, index_colorder("syslogins", indid, 1)
from sysindexes
where id = object_id ("syslogins")
and indid > 0
go
name
------ -----
syslogins ASC
ncsyslogins ASC
Returns the sort order ASC for the
indexes
syslogins and ncsyslogins on the
system table
syslogins.
See also:
ASE T-SQL - Aggregate Functions, audit_event_name(), col_length(), col_name(), curunreservedpgs(), datachange(), datalength(), data_pages(), data_pgs(), db_id(), db_name(), host_id(), host_name(), identity(), index_col(), isnull(), lct_admin(), license_enabled(), lockscheme(), next_identity(), object_id(), object_name(), pagesize(), pointer_size(), ptn_data_pgs(), reserved_pages(), reserved_pgs(), rowcnt(), row_count(), showplan_in_xml(), syb_sendmsg(), syb_sendmsg(), System Functions, tempdb_id(), tran_dumpable_status(), tsequal(), used_pages(), used_pgs().
|