Skip to content

Instantly share code, notes, and snippets.

Created December 7, 2012 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e1fc67ee961306422413 to your computer and use it in GitHub Desktop.
Save anonymous/e1fc67ee961306422413 to your computer and use it in GitHub Desktop.
Table Variables
--資料表變數名稱的前置詞 (@table_name)
--儲存於記憶體(Ram)
--批次指令執行完成後即自動被刪除
DECLARE @tbl_TMP TABLE (
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