A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: System Functions

data_pages()

The Funktion data_pages() is a System Funktion and, starting with ASE version 15.0, replaces the function data_pgs() and ptn_data_pgs() from earlier ASE-Versions. The function data_pages() can be executed by any user.

The function data_pages() returns the number of pages in a Tabelle, an index, or partition passed to the function in its parameters. The function only considers only pages not used by ASE internal structures.

Syntax of the System Function data_pages()

    data_pages ( dbid, object_id [, indid [, ptnid]])
    

The parameters of the System Function data_pages()

"dbid"
The parameter "dbid" is the unique identifier (id) of a database, as stored in the system table sysdatabases, containing the datapages.

"object_id"
The parameter "object_id" is the unique identifier (id) of the object as stored in the column "id" of the system table sysobjects of the corresponding database.

"indid"
The parameter "indid" is the unique identifier (id) of the corresponding index.

"ptnid"
The parameter "ptnid" is the unique identifier (id) of the corresponding partition. The id of a partition is stored in the column "id" of the system table syspartitions.

Example for the System Funktion data_pages()

    select data_pages(6, 1856006612)
go
-----
column_name

Returns the number of used pages of the object with id 1856006612, in the database with id 6.

Usage of the System Function data_pages()

The function data_pages() is restricted if the option "ptnid" is to be used: If a clustered index has been created for an APL Tabelle, i.e. on a table created with the locking scheme allpages locking, the function data_pages() can only be used if the parameter "indid" has been declared with one the values "0" or "1". "0" returns the number of pages used by data only. "1" returns the number of pages used by the index itself.

Error messages will be returned when dividing by zero. This can be the case if the "object_id" does not exist or if the target quot;indid" or target "ptnid" cannot be found.

See also
col_length(),
col_name(),
curunreservedpgs(),
data_pages(),
data_pgs(),
datalength(),
db_id(),
db_name(),
host_id(),
host_name(),
identity_burn_max(),
index_col(),
index_colorder(),
is_quiesced(),
isnull(),
lct_admin(),
license_enable(),
lockscheme(),
object_id(),
object_name(),
pagesize(),
pointer_size(),
pnt_data_pgs(),
reserved_pages(),
reserved_pgs(),
row_count(),
rowcnt(),
syb_quit(),
syb_sendmsg(),
tempdb_id(),
tran_dumptable_status(),
tsequal(),
used_pages(),
used_pgs() and
Functions.

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_length(),
col_name(),
curunreservedpgs(),
datachange(),
datalength(),
data_pgs(),
db_id(),
db_name(),
host_id(),
host_name(),
identity(),
index_col(),
index_colorder(),
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().