DB2 字段类型 --- SMALLINT (小整型) INTEGER (整型) BIGINT(大整型)

SMALLINT (小整型)


说明:小整型是两个字节的整数,精度为 5 位。小整型的范围从 -32,768 到 32,767。

增加字段:ALTER TABLE <tableName> ADD COLUMN <columnName> smallint

修改字段类型:ALTER TABLE <tableName> ALTER <columnName> SET DATA TYPE smallint

删除字段:ALTER TABLE <tableName> DROP <columnName>

验证字段范围:

insert into aaa(ddd) values(-32768)-- 执行成功
insert into aaa(ddd) values(-32769)-- 执行失败
insert into aaa(ddd) values(32767) -- 执行成功
insert into aaa(ddd) values(32768) -- 执行失败

查看字段:

Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------
<columnName> SYSIBM SMALLINT 2 0 Yes



INTEGER(整型)

说明:整型是四个字节的整数,精度为 10 位。整型的范围从 -2,147,483,648 到 2,147,483,647。

增加字段:ALTER TABLE <tableName> ADD COLUMN <columnName> integer

修改字段类型:ALTER TABLE <tableName> ALTER <columnName> SET DATA TYPE integer

删除字段:ALTER TABLE <tableName> DROP <columnName>

验证字段范围:

insert into aaa(col_interger) values(-2147483648)--成功
insert into aaa(col_interger) values(-2147483649)--失败
insert into aaa(col_interger) values(2147483647) --成功
insert into aaa(col_interger) values(2147483648) --失败

Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------
<columnName> SYSIBM INTEGER 4 0 Yes




BIGINT (大整型)


待补充~~



你可能感兴趣的:(Integer)