From: Erland Sommarskog on
lk (gofyself(a)wrong.address.com) writes:
> Therefore I had already verified that it gave me an error (invalid object)
> before I posted.

In your original post you said that the error was "invalid syntax near .".
There are situations when you can get syntax error in one database, but
not another, when the databases has different compatibility settings. But
I could not see that your query could have this effect.

Now you present a different error message: "invalid object", which casts
the problem in an entirely different light. You are simply running the
query from the wrong database. In the toolbar in Mmgt Studio there is a
dropdown where you can select which to database to work from. You can
also change the current database with the USE command:

USE AdventureWorks
go

In the future, make the habit to always post error messages in verbatim.
Thereby you can avoid this kind of confusion.


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx