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)
PeterBaileyUkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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
SELECT * FROM DATABASENAME.SCHEMA.TABLENAME

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...
0
PeterBaileyUkAuthor Commented:
I think this is what you meant but it says it cannot find the object name

use clientdata
go

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

Open in new window

0
John TsioumprisSoftware & Systems EngineerCommented:
Does your account has permissions to use this database...?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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

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...
0
PeterBaileyUkAuthor Commented:
this worked:

so I guess that proves the permissions

--use clientdata
--go

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

use Dictionary


SELECT * FROM [dbo].[TblCurrentWords]

Open in new window

0
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
0
PeterBaileyUkAuthor Commented:
thank you the tool you suggested got me to the correct 'way'

use ClientData

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

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