ASA SQL Reference
SQL Functions
Function types
System functions return system information.
The following system functions are available:
The following table displays the Adaptive Server Enterprise system functions and their status in Adaptive Server Anywhere:
Function | Status |
---|---|
Col_length |
Implemented |
Col_name |
Implemented |
Curunreservedpgs |
Not implemented |
Data_pgs |
Not implemented |
Datalength |
Implemented |
Db_id |
Implemented |
Db_name |
Implemented |
Host_id |
Not implemented |
Host_name |
Not implemented |
Index_col |
Implemented |
Lct_admin |
Not implemented |
Object_id |
Implemented |
Object_name |
Implemented |
Proc_role |
Always returns 0 |
Reserved_pgs |
Not implemented |
Rowcnt |
Not implemented |
Show_role |
Always returns NULL |
Suser_id |
Implemented |
Suser_name |
Implemented |
Tsequal |
Implemented |
Used_pgs |
Not implemented |
User_id |
Implemented |
User_name |
Implemented |
Valid_name |
Not implemented |
Valid_user |
Not implemented |
Some of the system functions are implemented in Adaptive Server Anywhere as stored procedures.
The db_id, db_name, and datalength functions are implemented as built-in functions.
The implemented system functions are described in the following table.
System function | Description |
---|---|
Col_length( table-name, column-name ) |
Returns the defined length of column |
Col_name( table-id, column-id [, database-id] ) |
Returns the column name |
Datalength( expression ) |
Returns the length of the expression, in bytes |
Db_id( [ database-name ] ) |
Returns the database ID number |
Db_name( [ database-id ] ) |
Returns the database name |
Index_col (table-name, index-id, key_# [, userid] ) |
Returns the name of the indexed column |
Object_id (object-name ) |
Returns the object ID |
Object_name ( object-id [, database-id ] ) |
Returns the object name |
Suser_id( [user-name] ) |
Returns an integer user identification number |
Suser_name( [user-id] ) |
Returns the user ID (server user name in Adaptive Server Enterprise) |
Tsequal (timestamp, timestamp2 ) |
Compares timestamp values to prevent update on a row that has been modified since it was selected |
User_id( [ user-name] ) |
Returns an integer user identification number. This does not return the Adaptive Server Anywhere user ID |
User_name( [user-id] ) |
Returns the user ID (user name in Adaptive Server Enterprise) |