

The SG increments each new IDENTITY value for every new row.įor a full list of all sequence generator attributes, see Sequence Generator. The SG generates values 1, 2, 3 and so on, until it reaches the maximum value for a LONG data type.


For more information, check MySQL manual for the version you use. It can be used to create different types of database tables, such as temporary tables. When the IDENTITY reaches the last number in the cache, the SG gets another set of values from the server automatically. In essence, you can create a new table from an existing table by adding a SELECT statement at the end of the CREATE TABLE statement. The SQL CREATE TABLE command is used to create a database table. The number of values that each client stores in its cache for fast retrieval. The syntax is the same for Oracle, SQL Server, MySQL, and PostgreSQL. You can set CACHE value to closely reflect the maximum value of the datatype, but we do not recommend this, due to the client cache size. This example uses the Create Table as Select to create a table from another table, but no data is added to the new table. CYCLE is orthogonal to the CACHE attribute, which indicates only how many values to store in local cache for swift access. When the IDENTITY reaches the MAXVALUE value, the SG restarts the values over, beginning with MINVALUE, if it is specified, or with the default MINVALUE for the data type. In Object Explorer, right-click the Tables node of your database and then select New Table. Specifying CYCLE indicates that the SG should supply IDENTITY values up to either the MAXVALUE attribute you specify, or the default MAXVALUE.
