Presentation is loading. Please wait.

Presentation is loading. Please wait.

FlowControl i T-SQL

Similar presentations


Presentation on theme: "FlowControl i T-SQL"— Presentation transcript:

1 FlowControl i T-SQL

2 Kontrolstrukture Sekvens – linje for linje Selektion – IFELSE – CASEWHEN(ELSE) Iteration – GOTO – WHILE

3 Selektion IFELSE – IF EXISTS(SELECT au_fname FROM authors WHERE au_lname = Jones) PRINT 'Found it' ELSE PRINT 'Not Found' – HUSK: BEGIN Hvis der er flere linjer at bruge BEGIN END END RETURN forlader eksempelvis IF

4 Selektion CASE WHEN – CASE WHEN condition THEN trueresult [...n] [ELSE elseresult] END

5 Selektion CASE WHEN – CASE WHEN booleanexpression THEN trueresult [...n] [ELSE elseresult] END

6 Iteration int = 0 do_it_again: < 10 BEGIN PRINT 'Hello World' WAITFOR DELAY '00:00:02' + 1 END < 10 GOTO do_it_again

7 Iteration int = 0 < 100 BEGIN PRINT 'Hello World' + 1 END

8 Iteration int = 0 10 BREAK ELSE CONTINUE END


Download ppt "FlowControl i T-SQL"

Similar presentations


Ads by Google