To get the seed and step values of an identity column in sql server i can use this syntax
为了获得sql server中的标识列的种子和步骤值,我可以使用此语法。
SELECT ColumnName = name, Seed = seed_value, Step = increment_value
FROM sys.identity_columns
So far in MySql i have found that if i use this syntax
到目前为止,在MySql中,我发现如果我使用这种语法的话
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE auto_increment IS NOT NULL
I can at least find out which columns are an identity...
我至少能找出哪些列是恒等式……
The question being how can i get the SEED and STEP values of the identity column from the MySQL Schema.
问题是如何从MySQL模式获取identity列的种子和步骤值。
1 个解决方案
#1
3
You can get the system wide settings using:
您可以使用以下方法获得系统范围内的设置:
SHOW VARIABLES LIKE 'auto_inc%';
The result:
结果:
| Variable_name | Value
+--------------------------+-------
| auto_increment_increment | 1
| auto_increment_offset | 1
Reference:
参考:
- auto_increment_increment
- auto_increment_increment
- auto_increment_offset
- auto_increment_offset
The only AUTO_INCREMENT attribute you can control outside of this is the starting value, using an ALTER TABLE statement:
在此之外,您可以控制的唯一AUTO_INCREMENT属性是使用ALTER TABLE语句控制的起始值:
ALTER TABLE tbl AUTO_INCREMENT = 100;
#1
3
You can get the system wide settings using:
您可以使用以下方法获得系统范围内的设置:
SHOW VARIABLES LIKE 'auto_inc%';
The result:
结果:
| Variable_name | Value
+--------------------------+-------
| auto_increment_increment | 1
| auto_increment_offset | 1
Reference:
参考:
- auto_increment_increment
- auto_increment_increment
- auto_increment_offset
- auto_increment_offset
The only AUTO_INCREMENT attribute you can control outside of this is the starting value, using an ALTER TABLE statement:
在此之外,您可以控制的唯一AUTO_INCREMENT属性是使用ALTER TABLE语句控制的起始值:
ALTER TABLE tbl AUTO_INCREMENT = 100;