DECLARE @Index INT
SET @Index=100
DECLARE UpdateCursor
CURSOR FOR (SELECT DISTINCT AA.Id FROM dbo.表 AA WHERE 数据过滤条件 )
OPEN UpdateCursor
DECLARE @DetailId NVARCHAR(36)
DECLARE @Name NVARCHAR(36)
FETCH NEXT FROM UpdateCursor INTO @DetailId
WHILE @@FETCH_STATUS=0
BEGIN
SET @Name=‘OQ14091‘+ CONVERT(NVARCHAR,@Index)----重新设置标号
UPDATE dbo.表 SET [email protected] WHERE Id= @DetailId
SET @[email protected]+1
FETCH NEXT FROM UpdateCursor INTO @DetailId
END
CLOSE UpdateCursor
DEALLOCATE UpdateCursor
GO
原文地址:https://www.cnblogs.com/hualiuliu/p/11453547.html
时间: 2024-10-07 02:58:25