Skip to content

Commit 0639bf9

Browse files
authored
Merge pull request #6695 from MarkPryceMaherMSFT/patch-3
Update break-transact-sql.md
2 parents e211be2 + f76c43f commit 0639bf9

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

docs/t-sql/language-elements/break-transact-sql.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ BREAK is usually inside an IF statement.
3232

3333
## Examples
3434

35+
### Example for SQL Server
3536
```sql
3637
WHILE (1=1)
3738
BEGIN
@@ -45,6 +46,26 @@ BEGIN
4546
END
4647
```
4748

49+
### Example for Azure Synapse Dedicated SQL Pool
50+
```sql
51+
declare @sleeptimesec int = 5;
52+
declare @startingtime datetime2 = getdate();
53+
54+
PRINT N'Sleeping for ' + cast(@sleeptimesec as varchar(5)) + ' seconds'
55+
WHILE (1=1)
56+
BEGIN
57+
58+
PRINT N'Sleeping.';
59+
print datediff(s, getdate(), @startingtime)
60+
61+
if datediff(s, getdate(), @startingtime) < -@sleeptimesec
62+
begin
63+
print 'We have finished waiting.'
64+
break;
65+
end
66+
END
67+
```
68+
4869
## See Also
4970

5071
- [Control-of-Flow Language &#40;Transact-SQL&#41;](~/t-sql/language-elements/control-of-flow.md)

0 commit comments

Comments
 (0)