Looping with the WHILE Statement : While « Transact SQL « SQL Server / T-SQL






Looping with the WHILE Statement

 


WHILE <Boolean expression>
      <sql statement> |
[BEGIN
      <statement block>
      [BREAK]
      <sql statement> | <statement block>
      [CONTINUE]
END]


WHILE 1 = 1
BEGIN
   WAITFOR TIME '01:00'
   RAISERROR('Statistics Updated for Database', 1, 1) WITH LOG
END

 








Related examples in the same category

1.While Loop Demo
2.Use while loop to insert data
3.while loop with counter
4.While with aggregate function