I need to maintain some values from one stored procedure and use them again in some other stored procedure.
Below is the part of my stored procedure where I am creating a global temp table.
IF object_id('tempdb..##TempNewSchedule') IS NULL
BEGIN
CREATE TABLE ##TempNewSchedule (OrderId INT)
END
INSERT INTO ##TempNewSchedule
VALUES(@OrderID)
So my requirement is like , whenever this SP will be called it will check if there is already a global temp table or not, If not then it should create a new global temp table , other wise it should insert the record into already created temp table. but every time it creates new temp table.
Please suggest any other approach also.
Thanks