I have a .NET page that executes a stored procedure. Inside that procedure, I need it to execute 2 other stored procedures. The 2 "other" stored procedures are SQL inserts, and the first one returns an INT that I want to use in the second stored procedure (see my code below).
The first insert procedure that is run inside my stored procedure is executing correctly, but it doesn't seem to be saving the returned INT variable that I need to use on the second insert procedure. What am I doing wrong? Is it syntax?
CREATE PROCEDURE spDCUserAddressCredit_Add
SET NOCOUNT ON;
declare @UserId bigint
Exec @UserId = spUsers_Add @pers_email, @pers_password
Exec spUsers_AddUpdateAddress @UserId, "test", "test", "test", "test", "test"