临时表的创建有两种,考虑有时候会对临时表做一些数据处理,create会方便很多

SELECT * INTO #temp1 FROM temp1

IF object_id(N'tempdb..#temp1',N'U') is not null
BEGIN
DROP TABLE #temp1
END
CREATE TABLE #temp1 (
id INT,
Amount DECIMAL(18,2)
)

insert into #temp1 select * from temp