SERIAL(start)

The SERIAL data type is a special data type that provides a sequence of consecutive values. To do this, DBMaker allocates an integer number for each table in a database and uses this number to generate a unique sequence for the corresponding table. DBMaker manages and maintains these integer numbers internally. The value of each integer value is automatically increased by one each time it is used. You can specify the first value in a sequence by providing an integer value for the optional START parameter when defining a SERIAL column, or you can omit the START parameter to use the default value of 1. Each table in a database can have only one column of the SERIAL data type.

Since the internal value used to generate a SERIAL number is actually an integer value, the SERIAL data type shares all of the properties of the integer data type. Like the INTEGER data type, it is an exact signed numeric data type with a precision of 10 and a scale of 0 that occupies 4 bytes of storage. The SERIAL data type also has the same range of values as the INTEGER data type, with a maximum value of 2,147,483,647 and a minimum value of -2,147,483,648.

To insert the next number in a sequence into a SERIAL column, place a NULL or empty value in the SERIAL column when you insert a new row into a table. DBMaker will insert the internal serial number for that table into the SERIAL column of the new record, and automatically increase the internal value by one.

If you insert a new and supply an integer value for the SERIAL column instead of a NULL or empty value, DBMaker will use the supplied integer value instead of the next number in the sequence, and will not increment the internal value. If the supplied integer value is greater than the last serial number generated, DBMaker will reset the sequence of generated serial numbers to start with the supplied integer value.

e.g. 100, 101, 102, 103, 104, 105, 106, 107
  100, 101, 50, 102, 103, 110, 111, 112

< SMALLINT | Contents | TIME >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.