While-Loop每循环需要1分钟

问题描述:

Hello,

是否有任何无限循环预防或其他SQL-Server 13.0中的机制,每个循环暂停一分钟?

is there any infinite-loop prevention or other machanism in SQL-Server 13.0 that for each loop there is a pause for one minutes?

查询:

输出:

While Start17:56:07:810

结束时17:56:07:923      1分钟暂停?

开始17:57:09:327 结束时   17:57:09:433      1
分钟暂停?
Start17:58:11:143

虽然结束  17:58:11:173

条件查询也以毫秒为单位完成...如果我在没有"while" - 语句三次的情况下执行它,它就完成了

The condition-query is also done in milliseconds ... if I execute it without the "while"-statement three times, it's done < 1 second.

是的,我也可以使用"with"进行,但我感兴趣的是为什么这不起作用,因为它是一个非常简单的查询。

Yes, I can do it with also with "with", but I'm interested in why this does not work cause it's a very simple query.

提前致谢

使用merge来更新你的表格:

Use merge to update your table:

Merge [generated].[CategoriesRoot] AS r
using  [generated].[CategoriesRoot] AS rr on rr.[category_id] = r.[category_id_root]
When matched and rr.[parent_category_id] <> '' then
Update
Set  [category_id_root] = rr.[parent_category_id];