I have multiple saved queries (each one was working fine when I developed them).
But when I load them in SSMS they immediately show error in every table name that's in the script. Moreover, I can't select the relevant DB from "Available databases" box (or any DB on that server, for that matter) and USE [DB_NAME]
command does not work, too.
However, if I'll navigate in "Object Explorer" to any table in any DB on the Server I want and do even a simple Select Top 1000
, then paste in whole query that's not working - voila - it runs fine.
Is it important for this that I'm connected to multiple SQL servers on different machines at the same time? In case it's needed - all SQL Server 2012.
Does anyone have a thought as to what's happening? It's extremely annoying to go through all the above steps each time I need a query ran. Thanks!
USE DB_NAME
command 'doesn't work'? What error message do you get?USE
statement (as seen here: msdn.microsoft.com/en-GB/library/ms188366.aspx), so that I don't get an error like the above one. Working across multiple servers with each multiple DB's with -sometimes very- similar structure I want to be sure I'm pulling correct information.