I would like to create multiple global temp tables using the same stored procedure. When I run the below I get table_@STAMP. How can I do this?
CREATE PROCEDURE ##CRTTBL
(@STAMP as INT,
@DATE as DATETIME)
AS
SELECT *
INTO ##table_@STAMP
FROM mytable
WHERE STARTDATE = @DATE AND STAMP = @STAMP;
EXECUTE ##CRTTBL @STAMP = 101, @DATE = '01/01/2022';
EXECUTE ##CRTTBL @STAMP = 102, @DATE = '01/01/2022';