-
-
Save anonymous/57f415f6e7721bddfebd to your computer and use it in GitHub Desktop.
Local Temporary Table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--本機暫存資料表名稱的前置詞 (#table_name) | |
--儲存於系統資料庫tempdb的sysobjects資料表(Disk/IO) | |
--只在目前工作階段中才可以看見 | |
--目前工作階段結束時,會自動卸除所有其他本機暫存資料表 | |
IF OBJECT_ID('tempdb..#tbl_TMP') IS NOT NULL | |
BEGIN | |
DROP TABLE #tbl_TMP | |
END | |
CREATE TABLE #tbl_TMP( | |
EmpID varchar(20), | |
Name varchar(100) | |
) | |
INSERT INTO #tbl_TMP | |
SELECT TOP 10 EmployeeID ,FirstName | |
FROM [Northwind].[dbo].[Employees] | |
SELECT * FROM #tbl_TMP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment