[SQL]建立temp table

  • 3851
  • 0

摘要:[SQL]建立temp table

方法有兩種:

大量資料的時候用, 因為它會用到disk IO

Create Table #TempTable(
id varchar(20),
name nvarchar(20)
)

drop table #TempTable

少量資料的時候,用@table變數就好啦,不用drop

DECLARE @TmpTable TABLE (
id varchar(20), 
name nvarchar(20)
)