SQL Server Loop

how sql server handles infinite loops? Whether it detects this or kills the server.

EG:

WHILE (@number = 3)
BEGIN
    print @number
END
+3
source share
2 answers

It depends on how long the client command waits.

By default, the .net application terminates after 30 seconds, and SSMS will wait forever (timeout = zero)

The SQL Server engine itself does not have the concept of "OK, I had enough"

+6
source

try :) no, it does NOT detect them. it is simply regarded as a long running transaction.

also any type of loop is a sign of really bad sql coding practice

+1
source

Source: https://habr.com/ru/post/1723757/


All Articles