在DB2中,它可以在下面的查询的帮助下完成,但我找不到在HSQLDB中执行此操作的方法
SELECT COLNAME FROM SYSCAT.COLUMNS WHERE IDENTITY = 'Y' AND TABNAME='XXX'.
下面是我可以看到的表SYSTEM_COLUMNS的列,我无法确定哪些列表明它是一个标识列
TYPE_SUB
TYPE_NAME
TABLE_SCHEM
TABLE_NAME
TABLE_CAT
SQL_DATETIME_SUB
SQL_DATA_TYPE
SOURCE_DATA_TYPE
SCOPE_TABLE
SCOPE_SCHEMA
SCOPE_CATLOG
说明
ORDINAL_POSITION
NUM_PREC_RADIX
NULLABLE
IS_NULLABLE
DECIMAL_DIGITS
DATA_TYPE
COLUMN_SIZE
COLUMN_NAME
COLUMN_DEF
CHAR_OCTET_LENGTH
BUFFER_LENGTH
答案 0 :(得分:0)
这应该这样做:
select column_name,
generation_expression,
is_generated,
is_identity,
identity_generation,
identity_start,
identity_increment
from information_schema.columns
where table_name = 'XXX'
and table_schema = 'PUBLIC'
and is_identity = 'YES'