sql writing data to temp code example
Example 1: create and insert into temp table
IF(@Debug = 1)
BEGIN
--TempTables for Testing
CREATE TABLE #_TempTable
(
FIRST INT,
SECOND INT,
);
INSERT INTO #_TempTable
SELECT @FIRST,
@SECOND
SELECT * FROM #_TempTable
END;
Example 2: sql server: creating temp table by selecting records from other tables
SELECT *
INTO #<Temp_Table_Name>
FROM <TableName>
WHERE <Conditions>
ORDER BY <Col_Names OrderSeq>
OPTION <Options>