Unanswered: Transfer value between stored procedures
I have 2 stored procedures one where a record is entered in a table. In this proc the newly entered ID is found using scope_identity(). I have another proc that needs this value. Is there any way to pass it between them or should a function be created to store that value and requested by the 2nd proc?
I prefer to have 2 separate procedures so that debugging is easier. I want to use a function to store the ID and then call it from the other procedure. I am new to TSQL syntax so any help on that? I have created the function as this:
ALTER FUNCTION dbo.Function2 (@storeid int)
1) Now my problem is how do I pass the @newStudentID from the procedure to this function. What is the syntax to be used? Was trying
exec dbo.function2 @newStudentID. Will that pass the variable to the function?