我需要在Mysql中获取标识列(主键列)的初始种子值。
SQL IDENT_SEED(TABLE_NAME)
我还需要获取标识列的递增和当前值,例如SQL的IDENT_INCR("table name")
和IDENT_CURRENT("table name")
。
我已经在"INFORMAION_SCHEMA"
表上搜索过列,表和统计信息,但无法得到我的结果。
您如何在MySQL上编写以下查询?
SELECT IDENT_SEED(TABLE_NAME) AS Seed, IDENT_INCR(TABLE_NAME) AS Increment,
IDENT_CURRENT(TABLE_NAME) AS Current_Identity
FROM
INFORMATION_SCHEMA.TABLES
WHERE
OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'TableHasIdentity') = 1
AND TABLE_TYPE = 'BASE TABLE'