Skip to content

Commit 92175fc

Browse files
authored
added syntaxsql and sql colorizers
1 parent 795782f commit 92175fc

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ ms.author: jroth
3636
## Syntax
3737

3838
```syntaxsql
39-
4039
RETURN [ integer_expression ]
4140
```
4241

@@ -62,7 +61,7 @@ RETURN [ integer_expression ]
6261
### A. Returning from a procedure
6362
The following example shows if no user name is specified as a parameter when `findjobs` is executed, `RETURN` causes the procedure to exit after a message has been sent to the user's screen. If a user name is specified, the names of all objects created by this user in the current database are retrieved from the appropriate system tables.
6463

65-
```
64+
```sql
6665
CREATE PROCEDURE findjobs @nm sysname = NULL
6766
AS
6867
IF @nm IS NULL
@@ -82,10 +81,10 @@ ELSE
8281
### B. Returning status codes
8382
The following example checks the state for the ID of a specified contact. If the state is Washington (`WA`), a status of `1` is returned. Otherwise, `2` is returned for any other condition (a value other than `WA` for `StateProvince` or `ContactID` that did not match a row).
8483

85-
```
84+
```sql
8685
USE AdventureWorks2012;
8786
GO
88-
CREATE PROCEDURE checkstate @param varchar(11)
87+
CREATE PROCEDURE checkstate @param VARCHAR(11)
8988
AS
9089
IF (SELECT StateProvince FROM Person.vAdditionalContactInfo WHERE ContactID = @param) = 'WA'
9190
RETURN 1
@@ -96,8 +95,8 @@ GO
9695

9796
The following examples show the return status from executing `checkstate`. The first shows a contact in Washington; the second, contact not in Washington; and the third, a contact that is not valid. The `@return_status` local variable must be declared before it can be used.
9897

99-
```
100-
DECLARE @return_status int;
98+
```sql
99+
DECLARE @return_status INT;
101100
EXEC @return_status = checkstate '2';
102101
SELECT 'Return Status' = @return_status;
103102
GO
@@ -115,8 +114,8 @@ GO
115114

116115
Execute the query again, specifying a different contact number.
117116

118-
```
119-
DECLARE @return_status int;
117+
```sql
118+
DECLARE @return_status INT;
120119
EXEC @return_status = checkstate '6';
121120
SELECT 'Return Status' = @return_status;
122121
GO
@@ -133,8 +132,8 @@ GO
133132

134133
Execute the query again, specifying another contact number.
135134

136-
```
137-
DECLARE @return_status int
135+
```sql
136+
DECLARE @return_status INT
138137
EXEC @return_status = checkstate '12345678901';
139138
SELECT 'Return Status' = @return_status;
140139
GO

0 commit comments

Comments
 (0)