Allan F
Allan F

Reputation: 2288

How to find/see tempdb in SQL Server

Should I expect to be able to see tempdb tables in SSMS?

e.g. If I run this code, should I expect to be able to see the table in SSMS?

-- Drop the table if it already exists    
IF (SELECT OBJECT_ID('tempdb..#TempPasswords')) IS NOT NULL
    DROP TABLE #TempPasswords

CREATE TABLE #TempPasswords (
    MemberNo    INT,
    Password    nvarchar(120),
    NewPassword varbinary(MAX)
)

Upvotes: 1

Views: 750

Answers (2)

Khairul Alam
Khairul Alam

Reputation: 1336

It is possible to see the temp DB but the name only. To see temp DB follow the instruction as per the image. After running the query right click on the Temporary Tables and Refresh .

enter image description here

Upvotes: 1

user11380812
user11380812

Reputation:

Only if you run your code snippet in SSMS. In that session you will be able to execute

T-SQL that include your temp table.

In order to see temp tables globally use two hashes ##.

Upvotes: 2

Related Questions