Fix SQL stored procedure syntax by using SELECT instead of RETURN#5328
Merged
roji merged 1 commit intodotnet:mainfrom Apr 14, 2026
Merged
Fix SQL stored procedure syntax by using SELECT instead of RETURN#5328roji merged 1 commit intodotnet:mainfrom
roji merged 1 commit intodotnet:mainfrom
Conversation
In SQL Server, RETURN is intended only for integer status codes so that SELECT is the correct for returning computed string results from a stored procedure
There was a problem hiding this comment.
Pull request overview
This PR corrects the SQL Server stored procedure example to return a computed string value via a result set, replacing the invalid use of RETURN (which is intended for integer status codes).
Changes:
- Updated the stored procedure example to use
SELECTinstead ofRETURNfor returning a concatenated string.
| @FirstName nvarchar(50) | ||
| AS | ||
| RETURN @LastName + @FirstName;')"); | ||
| SELECT @LastName + @FirstName;')"); |
There was a problem hiding this comment.
The stored procedure now uses SELECT (good), but the example will return a single unnamed column and concatenates without a separator (e.g., SmithJohn). Consider adding a space between parts and giving the selected expression a column alias (e.g., AS FullName) so the result is clearer for readers and tools.
Suggested change
| SELECT @LastName + @FirstName;')"); | |
| SELECT @LastName + N'' '' + @FirstName AS FullName;')"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In SQL Server, RETURN is intended only for integer status codes so that SELECT is the correct for returning computed string results from a stored procedure