I have the following query that generates the next available bill of lading numbers.
ALTER PROCEDURE [dbo].[GetNextTruckBol]
@FacilityId INT,
@Count INT = 1
AS
BEGIN
SET NOCOUNT ON;
UPDATE Facilities
SET NextTruckBol = NextTruckBol + @Count
OUTPUT DELETED.NextTruckBol
WHERE Id = @FacilityId
END
But now I need to modify it so that the resulting value is instead assigned to an OUTPUT
parameter.
I know how to declare the OUTPUT
parameter. How can I assign the value of OUTPUT DELETED.NextTruckBol
to that parameter?