I have a stored procedure called Sp_Ejecucion inside it create a temporary table with the following structure:
CREATE TABLE #CambioResult (FOL INT IDENTITY, RESULT INT)
and after that command to run another Sp as follows
BEGIN TRAN T1
DECLARE @vnCambiaRollTurnoResult INT = 0,
@vnReacomodoMarcajesResult INT = 0,
@Result INT = 0
BEGIN TRY
exec nsp_Exec @nClaEmp = @pnClaEmpresa,
@nClaTrab = @pnClaTrab,
END TRY
BEGIN CATCH
GOTO RETURN_ERROR
END CATCH
And the inside of the second stored I want to insert data to the table created in the first stored, How can I do it? what I have intended is the following:
INSERT INTO OBJECT_ID('tempdb..#CambioResult')
select @Error
pero marca error en esta parte OBJECT_ID