SQL-Server infinite loop
how does sql-server handle infi开发者_开发问答nite loops? Does it detect it or kill the server.
EG:
WHILE (@number = 3)
BEGIN
print @number
END
It depends on the client command timeout.
By default, a .net app will abort in 30 seconds and SSMS will wait forever (timeout = zero)
By itself, the SQL Server engine has no concept of "OK, I've had enough"
try it :) no it does NOT detect them. it's simply treated as a long running transaction.
also any kind of loop is sign of truely bad sql coding practice
精彩评论