This gives me an error on @ID and @Name saying Must declare the scalar variable, but i don’t understand why if it is a param. What am I doing wrong here?
CREATE PROCEDURE [dbo].[Ins_eProductFull]
@Name nvarchar(400)
,@ID int
AS
BEGIN
DECLARE @ID2 int
SET NOCOUNT ON;
INSERT INTO Table (Name) VALUES (@Name)
SET @ID2 = SCOPE_IDENTITY()
EXEC dbo.StoredProc1
@ID = @ID,
@Name = @Name,
@ID2 = @ID2
END
GO
only problem I see on your code is the first comma that should not be there. Other than that everything works fine
EDIT:
to whoever downvoted it, see for yourself:
result:
and the NULL is because there is no identity on my test table