getting invalid column name when selecting the porper co,umn names

I have created the query >
SELECT Last_name, first_name, middle_name, addr1, addr2, city, state, zip, home_phone, mobile_phone, date_of_birth, ssn, email

when I run it, every name is deemed invalid

when I add thr
FROM patients
it tells me that the name is also invalid

the names are correct, why am I getting the error?
dlennonAsked:
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.

Éric MoreauSenior .Net ConsultantCommented:
do a "select * from patients" to check that your column names are exactly the same
0
dlennonAuthor Commented:
do I need the quotes?
0
dlennonAuthor Commented:
whe I tried that, i get invalid object name "patients".  That is definitely yhte name of the table
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Éric MoreauSenior .Net ConsultantCommented:
you don't need the quotes.

where are you running this query from? From SSMS?
0
Mike EghtebasDatabase and Application DeveloperCommented:
add:

Use DatabaseName;

SELECT *
FROM dbo.patients


or

SELECT *
FROM schemaNameYouHave.patients

and run it
0
Ryan ChongCommented:
make sure u are connected to a valid schema with a valid table?
0
dlennonAuthor Commented:
I am running it from SMSS.  I tried before using dbo.tbl.patients, tbl_patients and patients.  now I tried dbo.patients and TOAMY.patients with the same error.
very frustrating
0
dlennonAuthor Commented:
I am connected to a valid schema and table.  When I open the table I can see all the column names and data
0
Éric MoreauSenior .Net ConsultantCommented:
In ssms, you have a combo on the top left of the query. Is your database selected in that combo (or is it written Master or some other database name)?
0
dlennonAuthor Commented:
the combo shows change type with a drop down. When Itry to click on the drop down, it is frozen
0
dlennonAuthor Commented:
I closed out and went back in to SMSS and now the combo is greyed out
0
Mike EghtebasDatabase and Application DeveloperCommented:
Locate the table, right-click on it, select Show top 1000...
0
Éric MoreauSenior .Net ConsultantCommented:
empty your query window and type:
use YourDatabaseNameGoesHere

Open in new window

and press F5 - your combo box should now show the name your database

now enter
select * from patients

Open in new window

and press F5
0
dlennonAuthor Commented:
when I cthe entire query designer toolbar is greyed out and there is no combo to change from Master to my database.  seems like something is not initialized
0
dlennonAuthor Commented:
when I start the query design editor, when I click on add table, there are no tables to add.  Ity seems like something is not truned on
0
Éric MoreauSenior .Net ConsultantCommented:
it looks like you are not connected! Can you show us a screen shot?
0
dlennonAuthor Commented:
if I man not connected, why do I see all the tables and can open the different tables
0
dlennonAuthor Commented:
I think it is a permission issue.  I am retrieving data form a client who's computer failed and I retrieved her datbase from her hard drive and attached it to my SMSS on my computer.  I am trying to add permissions to the database and I am having trouble with that.  Any Ideas how I can do it
0
dlennonAuthor Commented:
I ve an acount under logins and it is mapped to the database as a db owner even though under security/users the original owner is the db owner.   Nt sure if that is a problem
0
Ryan ChongCommented:
not too sure if you have read or can got some clues from this article?

Connect to your SQL Server
http://www.experts-exchange.com/articles/1881/Connect-to-your-SQL-Server.html
0
dlennonAuthor Commented:
I am grabbing at straws. not sure what is going on
0
dlennonAuthor Commented:
0
Éric MoreauSenior .Net ConsultantCommented:
you have a problem with your table name!

try:
select * from tbl_patients

Open in new window

1

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
dlennonAuthor Commented:
I already tried that with the same results.  I tried it again with the same result
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
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.