Advertisement
Guest User

clase 3 sql

a guest
Nov 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.45 KB | None | 0 0
  1. DECLARE @indice INT;
  2. SET @indice=0 ;
  3.  
  4. WHILE (@indice<=10)
  5. BEGIN
  6.     PRINT CAST(@indice AS VARCHAR(10))
  7.     IF @indice=7
  8.     BEGIN
  9.         SET @indice=@indice+1;
  10.         WAITFOR DELAY '00:00:05'
  11.         CONTINUE;
  12.     END
  13.    
  14.     ---- Dos formas de salir forzando el while
  15.     IF @indice=4 GOTO mensaje;
  16.     IF @indice=6 BREAK;
  17.     ----------------------------------------
  18.     SET @indice=@indice+1;
  19. END
  20. PRINT 'SALI DEL WHILE POR EL BREAK'
  21. mensaje:
  22. PRINT 'SALI DEL WHILE POR EL GOTO'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement