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

identity()

The system function identity() is actually a function of the data manipulation language. But as there are only a few functions under this category, identity() is listed under system functions in sybinfo. The function identity is only appicable to select...into statements. If a new table is created using this statement, with the help of the function identity an identity column can be added to the table. If one of the columns in the original table already has been marked as an identity column, and another identity column is added, the statement fails to complete.

Syntax of the System Function identity()

    identity("precision")
    

The parameters of the System Function identity()

"precision"
If the parameter "precision" of the function identity is only a number, the column is specified as datatype numeric with a precision as specified by the number in the parameter. Otherwise, any of the datatypes int, smallint or tinyint can be specified.

Example for the System Function identity()

    select *, id_sequence=identity(6)
    into new_table
    from original_table
    go

Creates a copy of the table "original_table" with an identity column called &quotid_sequence" as datatype "numeric" with a precision of "6".

    select *, id_sequence=identity(smallint)
    into new_table
    from original_table
    go

Creates a copy of the table "original_table" with an identity column called &quotid_sequence" as datatype "smallint".

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(),
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().