Return Value - Stored Procedure

Опубликовано: 05 Ноябрь 2024
на канале: Way2Achieve
3,016
10

Return Value. Microsoft SQL Server Online Training For Beginners With Advance Concepts


https://sekhar.thinkific.com/courses/...


Learn at Udemy

https://www.udemy.com/microsoft-sql-s...


• Return value returns only integer value.
• Also it is not possible; to return more than one value using return value.

Create Procedure GetCustomersByCountryNameReturn
@CountryName varchar(50)
AS
Begin
Select * From Customers Where Country=@CountryName

return (Select count(CustomerId) From Customers Where Country=@CountryName)

The return will return the total customer’s count country wise.

END

Open a new query window.

Declare @TotalCount int

In order to get the return value

exec @TotalCount=GetCustomersByCountryNameReturn 'India'


Select @TotalCount