Hey guys i need your help. I am going to execute multiple stored-procedures within a stored procedure, but for now, i need to know how to get the output value from one executed stored-procedure within a stored-procedure
.First Stored-Procedure
Create Procedure [dbo].[Check_IF_Person_Exist]
@FirstName nvarchar(50),
@LastName nvarchar (50),
@Guid nvarchar(50),
@intPersonID int OUTPUT
AS
BEGIN
IF EXISTS( SELECT ID FROM ITTESI_AssetTracker_Person WHERE Guid = @Guid)
BEGIN
SET @intPersonID = ( SELECT [ID] FROM AssetTracker_Person WHERE Guid = @Guid)
END
ELSE
BEGIN
INSERT INTO ITTESI_AssetTracker_Person VALUES (@Guid,@FirstName,@LastName)
SET @intPersonID = @@IDENTITY
END
END
first stored-procedure already works.
Second Stored-Procedure
Create procedure InsertAssets1
@Location int,
@LocationName nvarchar(50),
@Manufacturer nvarchar(50),
@Model nvarchar(50),
@AssetTag nvarchar(50),
@AssignedDate nvarchar(50),
@GUID int,
@FirstName nvarchar(50),
@MiddleName nvarchar(50),
@LastName nvarchar(50),
@Condtion nvarchar(50),
@Notes nvarchar(Max)
As
BEGIN
Exec Check_IF_Person_Exist @FirstName,@LastName,@GUID
END
So my ultimate question, is how do i get the id returned by executing Check_IF_Person_Exist and how do i put that in a variable because i will need it for another stored-procedure.
Thanks for your help.