By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,011 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,011 IT Pros & Developers. It's quick & easy.

Error... Invalid object name 'data1'.

P: n/a
I have a db that has a table x in it called data1

I have a program that does to things, updates values in the data1
table and also inserts new rows into this table. The update existing
values works great. Then when the insert loop runs, I get this error
on the following line.

insert into data1 ('AdminManageLogIn','Password') Values ('123','222')

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'data1'.

I am connected to the table x in the earlier step, I do the update
and all is fine then I change the sql statement to

insert into data1 ('AdminManageLogIn','Password') Values ('123','222')

and it gives me this error.

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'data1'.

Thanks in advance for your assistance.
Dean-O
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If you are sure you are in the right database then I would look at WHO owns
data1. For your statement to work it either needs to be you ir dbo.
Anybody else and it will throw your error.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know
"rockie12" <ro******@dtnspeed.net> wrote in message
news:d1**************************@posting.google.c om...
I have a db that has a table x in it called data1

I have a program that does to things, updates values in the data1
table and also inserts new rows into this table. The update existing
values works great. Then when the insert loop runs, I get this error
on the following line.

insert into data1 ('AdminManageLogIn','Password') Values ('123','222')

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'data1'.

I am connected to the table x in the earlier step, I do the update
and all is fine then I change the sql statement to

insert into data1 ('AdminManageLogIn','Password') Values ('123','222')

and it gives me this error.

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'data1'.

Thanks in advance for your assistance.
Dean-O

Jul 20 '05 #2

P: n/a

"rockie12" <ro******@dtnspeed.net> wrote in message
news:d1**************************@posting.google.c om...
I have a db that has a table x in it called data1

I have a program that does to things, updates values in the data1
table and also inserts new rows into this table. The update existing
values works great. Then when the insert loop runs, I get this error
on the following line.

insert into data1 ('AdminManageLogIn','Password') Values ('123','222')

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'data1'.

I am connected to the table x in the earlier step, I do the update
and all is fine then I change the sql statement to

insert into data1 ('AdminManageLogIn','Password') Values ('123','222')

and it gives me this error.

Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'data1'.

Thanks in advance for your assistance.
Dean-O


First., you should remove the quotes around your column names:

insert into data1 (AdminManageLogIn,Password) Values ('123','222')

You should also check the owner of the object - it's always good practice to
qualify the object name with its owner:

insert into dbo.data1 (AdminManageLogIn,Password) Values ('123','222')

Finally, another possibility is that your database is case-sensitive and the
correct object name is Data1 (or whatever) not data1.

Simon
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.