main Difference between returns and return ? what use this keyword give one example ...........
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhinav PalPosted Oct 16, 2015, 7:45 AM
RETURN can be used any where in t-sql.It will immediately stop the execution from the point where RETURN keyword is found and will not execute further lines of t-sql code. Additionally RETURN keyword can also return some value out from the procedure stopping the execution from there.
RETURNS is limited to scalar and table valued functions defining the return type information. Like below
CREATE FUNCTION xyz(@minId int) -- input parameter
RETURNS @tableXYZ TABLE (
Id int NOT NULL,
Modified datetime NULL
)
AS
BEGIN
Insert into @tableXYZ
Select 1, getdate ()
RETURN;
Priyaranjan K SPosted Oct 16, 2015, 7:20 AM