sql server query

What s the query syntax to query a table from another db.  am currently n a db named ClentData where some tables resse but  also want to get to a table n a bd called dctonery(sorry lost a letter on my keyboard)
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.

John TsioumprisSoftware & Systems EngineerCommented:
Try this

Open in new window

so in your case should be
SELECT * FROM dctonery.dbo.n

Open in new window

The schema dbo is just an assumption because its very common...
PeterBaileyUkAuthor Commented:
I think this is what you meant but it says it cannot find the object name

use clientdata

SELECT * FROM dictionery.[dbo].[TblCurrentWords]

Open in new window

John TsioumprisSoftware & Systems EngineerCommented:
Does your account has permissions to use this database...?
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

PeterBaileyUkAuthor Commented:
here is a screenshot of the structure
PeterBaileyUkAuthor Commented:
yes I have the permissions as I created both dbs
John TsioumprisSoftware & Systems EngineerCommented:
How about making a select on dictionery database...strange...

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
John TsioumprisSoftware & Systems EngineerCommented:
As a workaround because maybe something is not as it seems ....go to DevART and download dbForge SQL Complete, v5.5 Express...after you install this you will have intellisense when you are doing queries and it will show you the proper syntax...
PeterBaileyUkAuthor Commented:
this worked:

so I guess that proves the permissions

--use clientdata

--SELECT * FROM dictionery.[dbo].[TblCurrentWords]

use Dictionary

SELECT * FROM [dbo].[TblCurrentWords]

Open in new window

John TsioumprisSoftware & Systems EngineerCommented:
How about right clicking your Dictionary database and Refresh
EDIT: have you tried to match exactly the case ...i see Dictionary working but...dictionary is lowercase
maybe your server collation is case sensitive...so lowercase <> uppercase
PeterBaileyUkAuthor Commented:
thank you the tool you suggested got me to the correct 'way'

use ClientData

SELECT * FROM Dictionary.dbo.TblCurrentWords
John TsioumprisSoftware & Systems EngineerCommented:
So i guess it was case sensitive issue...
Vitor MontalvãoMSSQL Senior EngineerCommented:
You just got a typo in your select:
SELECT * FROM dictionery.[dbo].[TblCurrentWords]

Should be 'a' instead of 'e'.
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
Query Syntax

From novice to tech pro — start learning today.