Field Types in the DB2 database

Source: Internet
Author: User

The field type of DB2 is the basis for getting started with the DB2 database. The following lists the field types in the DB2 database for your reference. The details are as follows:
Field Type Description Field Length and default value

Char (size)

It is used to save string data of a fixed length (size) byte.

 

Fill in space for less than the fixed length of each line). The maximum length is 254 bytes. The default value is 1 byte for each line.

Varchar (size)

Used to save variable-length string data. The maximum byte length is specified by (size.

The length of each line is variable. The maximum length is 4000 bytes. The default data length is 1.

Long varchar

Used to save variable-length string data.

The length of each line is variable. The maximum length is 4321700 bytes.

Graphics (size)

Double-byte string.

 

Fill in spaces for the remaining fixed length of each line ). Length (size) refers to the number of characters, the maximum number of bytes is size * 2.

Vargraphics (size)

Variable Length, double-byte string.

Each line gets longer. Length (size) refers to the number of characters, the maximum number of bytes is size * 2.

Long vargraphic

Double-byte string.

The maximum length is 16350 double-byte strings.

Timestamp

Binary data used to change management, including year, month, day, hour, minute, and second.

26 bytes

Date

Save the Date data with a fixed length, ranging from 0000 to 9999.

Each row is fixed to 10 bytes in length.

Time

Save data for a specified period of time.

Each line is fixed to 8 bytes in length.

Int

Stores integer data in the range of-2147483648 to + 2147483647.

The maximum length is 4 bytes 32-1 bytes or 4 GB.

Smallint

Stores integer data in the range of-32768 to + 32767.

The maximum length is 2 bytes 32-1 bytes or 4 GB.

Double

Save the floating point data type. The value range is-2.23E-308 to + 2.23E-308.

The maximum length is 8 bytes.

Float

Save the floating point data type. The value range is-2.23E-308 to + 2.23E-308.

The maximum length is 8 bytes.

Numeric (p, s)

The data type of the exact value is saved. The value range is-10E-38 to + 10E-38. p indicates the precision and the total decimal places (1 ~ 38), s is the decimal point (decimal point less than or equal to p)

The maximum length is 2 ~ 17 bytes.

Decimal (p, s)

The data type of the exact value is saved. The value range is-10E-38 to + 10E-38. p indicates the precision and the total decimal places (1 ~ 38), s is the decimal point (decimal point less than or equal to p)

The maximum length is 2 ~ 17 bytes.

Text

Save text data within 2 GB.

The maximum length is 2 GB.

Text

Saves two-byte text data within 1 GB.

The maximum length is 1 GB.

Blob

Saves binary data within 2 GB.

The maximum length is 2 GB.

Example of Using Dynamic Cursor for DB2 stored procedures

Three methods of minimum restoration timestamp for DB2 tablespace Rollback Recovery

Table space size restrictions in DB2 Databases

Test the DB2 temporary table in the SQL process and SQL statement

Causes and solutions for temporary suspension of DB2 tables

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.