Skip Top Menu Navigation
Skip Top Menu Navigation

The FREE Enterprise Open Source Database

  Software Documentation Tools Interfaces Administration Development
 

 
You Are Here:
SAP DB > Documentation > How To > Number Generator > SERIAL data type > Use of DEFAULT SERIAL

SAP DB is now SAP MaxDB! For more information, visit the SAP MaxDB pages in the SAP Developer Network.

Use of DEFAULT SERIAL (Example)

Use

You use DEFAULT SERIAL to automatically generate a primary key.

Syntax

CREATE TABLE mytab (seqcol SERIAL PRIMARY KEY, other_col CHAR (20))

INSERT mytab (other_col) VALUES (‘value of other col’)

INSERT mytab (other_col) VALUES (‘second other value’)

Result

The following two rows are generated:

1, ‘value of other col’

2, ‘second other value’



Search / Contact Info

Questions or comments about the Web site? Contact the webmaster.