我在我的表上做了一些更改,我无法弄清楚这个问题。 这是我的SQL脚本;
I am doing some changes on my table and I couldn't figure out the problem. This is my SQL script;
ALTER TABLE X ALTER COLUMN X_ID RESTART WITH (SELECT MAX(X_ID) FROM X);我使用 AS c $ c> WITH 并尝试其他组合,我找不到确切的语法。 (顺便说一下,我不能在初始化中设置此属性,我必须在创建表之后才执行此操作)
Altough I used AS instead of WITH and tried other combinations, I couldn't find the exact syntax. (By the way, I cannot set this property in the initialization, I got to do it after creation of the table )
推荐答案查看 ALTER TABLE ,您将发现只能使用常量,例如RESTART WITH 12345。查询本身是不可能的。对于自动化,您需要分解它,使用一个变量,生成ALTER语句并执行它。
When looking at the syntax for ALTER TABLE you will find that you can only use a constant, e.g., "RESTART WITH 12345". A query itself is not possible. For automation you would need to break it up, use a variable, generate the ALTER statement and execute it.
更多推荐
使用MAX()方法重新启动表的初始ID
发布评论