Inserting data into a temporary table

后端 未结 14 1506
情书的邮戳
情书的邮戳 2020-12-22 22:28

After having created a temporary table and declaring the data types like so;

CREATE TABLE #TempTable(
ID int,
Date datetime,
Name char(20))

H

14条回答
  •  不知归路
    2020-12-22 22:46

    To insert all data from all columns, just use this:

    SELECT * INTO #TempTable
    FROM OriginalTable
    

    Don't forget to DROP the temporary table after you have finished with it and before you try creating it again:

    DROP TABLE #TempTable
    

提交回复
热议问题