Display table names in titles in SQL Server Management Studio
No, there is no way to make Management Studio do that. You've opened a query window, and you can customize what is displayed there, but table name is not one of the choices. After all, a small number of queries involve only one table. And think about these questions:
- If you add another query to that window, what should the title become?
- If you change the query it produced to be a join, what then?
- If you've saved the query as some file, should the table name override the name you gave?
These questions are rhetorical, since the functionality is not possible anyway, but there are many other technical considerations that go far beyond right-clicking a table and saying SELECT TOP
...
SSMSBoost seems to give you some control over these things, but I don't see table name as being an option here either (probably for the same technical challenges I raised in my bullets).
As a workaround I sometimes add a fixed text as first column to my SELECT
s. This can increase readability, if you have many result tables at once.
SELECT 'The contents of table X' as INFO, * FROM table_x
SELECT 'The contents of table Y' as INFO, * FROM table_y
Or, even better (even works when the result table is empty):
SELECT '' AS 'The contents of table X', * FROM table_x
SELECT '' AS 'The contents of table Y', * FROM table_y
If, when opening a table you choose Edit Top X Rows
instead of Select Top X Rows
:
The table name will then be displayed in the address bar:
which makes navigating between already open tables much easier.
You can use the SQL button if you need to edit the query in any way, but if you change it too much it defeats the object of having the table name in the title to start with.
Of course you should be using your "read only" user to do this on production systems.