Microsoft SQL Server Local Temp Table


  • Will be available till the current connection persists for the user.

    Automatically deleted when the user disconnects.

    The name should start with # (#temp)

     CREATE TABLE #LocalTempTable(
                    StudentID      int,
                    StudentName    varchar(50), 
                    StudentAddress varchar(150))
insert into #LocalTempTable values ( 1, 'Ram','India');

select * from #LocalTempTable

After executing all these statements if we close the query window and open it again and try inserting and select it will show an error message

“Invalid object name #LocalTempTable”