本地暫存表/預存程序

預存程序的本地暫存表,本地暫存表會在預存程序結束之後刪除。

//***創造預存程序**//
create procedure spzoetemp
as
begin
create table #zoetesttemp(Id int,name nvarchar(3));
insert into #zoetesttemp Values(1,'Zoe')
select * from #zoetesttemp

end
//**執行預存程序**/
execute spzoetemp

//**選擇佔存表 不能 因為這個表在預存程序執行結束後就消失!**//
select * from #zoetesttemp

訊息 208,層級 16,狀態 0,行 13
Invalid object name '#zoetesttemp'.


留言

這個網誌中的熱門文章

刪除大量資料造成Lock escalation鎖定升級 SQL Server

避免登出後,讀取快取返回上一頁。 How to prevent seeing previous page after logout?

SAP Connector for Microsoft .NET 3.0-------Cannot convert String into DATE/TIME