本文主要是介绍达梦判断哪列是自增列|查询自增信息|重构自增列|自增改为sequence,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
### Code Reference
- URL:p115 DM8系统管理员手册
- DESC:达梦判断哪列是自增列|查询自增信息|重构自增列|自增改为sequence
- Last Update:2020-7-1 10:58
- 判断自增列
left JOIN (SELECT *
FROM syscolumns t
WHERE id =
(SELECT object_id
FROM dba_objects t
WHERE 1=1
AND t.owner = ‘TEST’
AND t.object_name = ‘WhichCanEncrypt’
AND object_type = ‘TABLE’)
) t7 on (t7.NAME = t4.COLUMN_NAME) - 自增列的属性
CREATE TABLE test.“aIDENT_TABLE” (
C1 INT IDENTITY(1, 11),
C2 INT
);
SELECT IDENT_CURRENT(‘TEST.aIDENT_TABLE’);
SELECT IDENT_SEED(‘TEST.aIDENT_TABLE’);
SELECT IDENT_INCR(‘TEST.aIDENT_TABLE’); - 重构自增信息
SELECT NAME AS c_columnname,
(decode(info2, 1, ident_incr(‘TEST.WhichCanEncrypt’), NULL, -1, -2) +
decode(info2, 1, ident_current(‘TEST.WhichCanEncrypt’), NULL, -1, -2)) AS c_identitycurrent,
decode(info2, 1, ident_seed(‘TEST.WhichCanEncrypt’), NULL, -1, -2) AS c_identitystartvalue,
decode(info2, 1, ident_incr(‘TEST.WhichCanEncrypt’), NULL, -1, -2) AS c_identitystep
FROM sys.syscolumns t
WHERE id =(SELECT object_id
FROM dba_objects t
WHERE t.owner = ‘TEST’
AND t.object_name = ‘WhichCanEncrypt’
AND object_type = ‘TABLE’)
AND info2 = 1;
- 判断自增列
这篇关于达梦判断哪列是自增列|查询自增信息|重构自增列|自增改为sequence的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!