dbcc pravailabletempdbs

dbcc pravailabletempdbs prints the global list of available temporary databases.

Example

1> dbcc pravailabletempdbs
2> go
Available temporary databases are:
Dbid: 2
Dbid: 4
Dbid: 5
Dbid: 6
Dbid: 7
DBCC execution completed. If DBCC printed error messages, contact a user with System Administrator (SA) role.