Hi Friends,
Ask any SQL DBA for his favorite SQL Server Keyboard Shortcuts and most would reply; ALT + F1. But what has gone wrong now?
Option 1: Select the table name and press ALT + F1.
Result: Doesn’t work.
Error: Msg 15009, Level 16, State 1, Procedure sp_help, Line 66
The object ‘SalesOrderHeader’ does not exist in database ‘AdventureWorks2008R2’ or is invalid for this operation.
Option 2: Select the schema & table name and press ALT + F1.
Result: Doesn’t work.
Error: Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ‘.’.
Option 3: Enclose the table name in square brackets, Select and press ALT + F1.
Result: Same as option 1
Option 4: Enclose the schema & table name in square brackets, Select and press ALT + F1.
Result: Same as option 2
Option 5: Enclose the schema & table name in single square brackets, Select and press ALT + F1.
Result: Works 🙂
But, does the select statement work in case of option 5?
NOOOOOOOOOOO !
Now try all the above 4 options with table DatabaseLog
Result: it all works 🙂
Conclusion: I am confused 😉 Really?
Well, Databaselog belongs to dbo schema. ALT + F1 shortcut works the way it should work for tables belonging to dbo schema.
Feedback, comments and your observation is welcomed. If you can get it working with other schema, do let us know. I tried all the above in SQL Server 2008 R2. I don’t know who it is like in SQL 2012.
As it works in Sql 2005 but not in Sql 2008 R2 bcoz of the dbo schema.
Hi Amit
This is because of your default schem is dbo, please change it sales, it will start working for sales & dbo both.
Hi amit,
This is because of your default schema is dbo, please set it to sales “ALTER USER [ijs] WITH DEFAULT_SCHEMA=[sales]” then it will start working for both dbo & Sales.
Thanks
Indrajeet
This did not worked in sql server 2008. Any other solutions?
Nice Observation Amit. Thanks for sharing this
Seems to work as designed in SQL2014.