gpt4 book ai didi

sql - 如何在 SQL Server 中重置表的 IDENTITY 列?

转载 作者:行者123 更新时间:2023-12-02 17:16:02 25 4
gpt4 key购买 nike

<分区>

如何重置已填充表格中的 IDENTITY 列?

我试过类似的方法,但它不起作用

WITH TBL AS
(
SELECT
*,
ROW_NUMBER() OVER(ORDER BY profile_id) AS RN
FROM
Profiles
)
UPDATE TBL
SET profile_id = RN

错误:

Cannot update identity column 'profile_id'.

enter image description here

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com