sql server

sql server 流程控制语句

2020-04-10  本文已影响0人  z_strive

流程控制语句:begin...end、if、if...else、if...else if...else if...、case...when...then...when...then...else...end、while、

continue、break、return、goto、waitfor

例子:

if、if...else、if...else if...else if...

begin...end:逻辑块包含其中

case...when...then(case...when...then...else...end)...when...then...else...end、

while...begin...set...end

while、continue、break。

continue:满足条件,不再执行continue之后的语句,而重新开始循环。

break:满足条件直接退出循环,执行end之后的语句。

goto:改变程序执行的流程,使程序跳转到标识符指定的程序。标识符后面需要加冒号。

return:在查询或过程中直接退出,之后的语句不再执行。

waitfor:指定存储过程、触发器、事务执行的时间或者时间间隔。还可以暂停程序的执行,过了时间后才执行

    用法:waitfor delay "time" ---在这个时间后执行    或者     waitfor  Time  "time" ---到这个时间时执行

    

上一篇 下一篇

猜你喜欢

热点阅读