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

rowcnt()

The system function rowcnt() returns the estimated number of rows in the specified table. The return value is not determined by scanning the whole table, but using the object allocation map, or short OAM page of the table. The value received is usually correct, but can be distorted by regular insert or delete statements, if ASE is rebooted, or when recovering transactions. The value is exact after running one of the following commands:

  • dbcc checkalloc
  • dbcc checkdb
  • dbcc checktable
  • update all statistics
  • update statistics
The system function "rowcnt()" is, starting with ASE version 15.0, replaced by the function row_count(). The function "rowcnt()" can be executed by any user.

Syntax of the System Function rowcnt()

    rowcnt(sysindexes.doampg)
    

The parameter of the System Function rowcnt()

"sysindexes.doampg"
The function "rowcnt()" is used in queries on the column "doampg" of the system table sysindexes.

Example for the System Function rowcnt()

    select name, rowcnt(sysindexes.doampg)
from sysindexes
where name in
(select name from sysobjects where type = "U")
name
------------------------------ ---------------------
roysched 87
salesdetail 116
stores 7
discounts 4
au_pix 0
blurbs 8
people 3

Returns a list of all user table objects and lists the number of existing rows for each table.

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(),
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_pages(),
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(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().