index_colorder

Description

Returns the column order.

Syntax

index_colorder(object_name, index_id, key_#[, user_id])

Parameters

object_name

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.

index_id

is the number of object_name’s index. This number is the same as the value of sysindexes.indid.

key_#

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.

user_id

is the owner of object_name. If you do not specify user_id, it defaults to the caller’s user ID.

Examples

Example 1

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

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute index_colorder.

See also

Documentation Transact-SQL Users Guide