Returns the column order.
index_colorder (object_name, index_id, key_# [, user_id])
is the name of a table or view. The name can be fully qualified (that is, it can include the database and owner name). It must be enclosed in quotes.
is the number of object_name’s index. This number is the same as the value of sysindexes.indid.
is a key in the index. Valid values are 1 and the number of keys in the index. The number of keys is stored in sysindexes.keycnt.
is the owner of object_name. If you do not specify user_id, it defaults to the caller’s user ID.
Returns “DESC” because the salesind index on the sales table is in descending order:
select name, index_colorder("sales", indid, 2) from sysindexes where id = object_id ("sales") and indid > 0
name ------------------------- ------------------------- salesind DESC
index_colorder, a system function, returns “ASC” for columns in ascending order or “DESC” for columns in descending order.
index_colorder returns NULL if object_name is not a table name or if key_# is not a valid key number.
For general information about system functions, see “String functions”.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute index_colorder.
Copyright © 2005. Sybase Inc. All rights reserved. |