sql query sql 2008

getting the following error message
Msg 7313, Level 16, State 1, Line 1
An invalid schema or catalog was specified for the provider "Local Server" for linked server "(null)".

trying to query two tables in different databases on the same server.

the query is as follows:


select a.username, a.trandate, a.fld1, a.fld2, afld3, a.fld4, a.fld5, afld7, a.fl8, a.fld9,
a.fld10, a.action, b.fld1
from myserver..database1.table a, myserver..database2.table b
where
a.fld1 = b.fld1
Amanda WalshawBusiness Solutions AnalsystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cyberkiwiCommented:
same server..

select a.username, a.trandate, a.fld1, a.fld2, afld3, a.fld4, a.fld5, afld7, a.fl8, a.fld9,
a.fld10, a.action, b.fld1
from database1..table a, database2..table b

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cyberkiwiCommented:
note two dots between the db name and the table name
If the schema is not dbo in either/both case(s), add the schema name, e.g.

select a.username, a.trandate, a.fld1, a.fld2, afld3, a.fld4, a.fld5, afld7, a.fl8, a.fld9,
a.fld10, a.action, b.fld1
from database1.dbo.table a, database2.test.table b
Amanda WalshawBusiness Solutions AnalsystAuthor Commented:
straight to the point
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.