While-Loop每循环需要1分钟 [英] While-Loop takes 1min per loop

查看:83
本文介绍了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?

查询:

输出:

< span style ="font-size:9.5pt; font-family:Consolas; color:black; background:white"> 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" - 语句三次的情况下执行它,它就完成了<1秒。

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];


这篇关于While-Loop每循环需要1分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆