Unable to show database objects error
MikeyC
Posts: 249 Bronze 3
I am running SQL Prompt 4.0.4.14 and have found that in some cases SQL Prompt tries to access a database for no reason, and if you don't have access you get an error.
Say that the server you are working on has a DB named NPI, but you don't have access to it. When you paste this code in to SSMS you will get an error.
It even happens without a temp table:
I'm not sure why it thinks that the NPI. in the query refers to a DB instead of to the alias, but it is annoying.
Say that the server you are working on has a DB named NPI, but you don't have access to it. When you paste this code in to SSMS you will get an error.
SELECT 'X' AS NPI INTO #NPI SELECT * FROM #NPI NPI WHERE NPI.NPI IS NOT NULL
It even happens without a temp table:
SELECT * FROM msdb.dbo.backupfile NPI WHERE NPI.backed_up_page_count IS NOT NULL;
I'm not sure why it thinks that the NPI. in the query refers to a DB instead of to the alias, but it is annoying.
Comments
I think we have noticed this already and it should be fixed in a future version. It doesn't apply strictly to databases, but could also happen if your alias name is the same as another table in the same database. The bug reference number is SP-2370.