Skip to content

Fix SQL stored procedure syntax by using SELECT instead of RETURN#5328

Merged
roji merged 1 commit intodotnet:mainfrom
srdrtmy:patch-1
Apr 14, 2026
Merged

Fix SQL stored procedure syntax by using SELECT instead of RETURN#5328
roji merged 1 commit intodotnet:mainfrom
srdrtmy:patch-1

Conversation

@srdrtmy
Copy link
Copy Markdown
Contributor

@srdrtmy srdrtmy commented Apr 14, 2026

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

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
Copilot AI review requested due to automatic review settings April 14, 2026 07:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SELECT instead of RETURN for returning a concatenated string.

@FirstName nvarchar(50)
AS
RETURN @LastName + @FirstName;')");
SELECT @LastName + @FirstName;')");
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;')");

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, makes sense.

@roji roji merged commit 7b90f48 into dotnet:main Apr 14, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants