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-OIf 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" <rockie12@.dtnspeed.net> wrote in message
news:d10dd1b6.0407190412.104bb5dd@.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|||"rockie12" <rockie12@.dtnspeed.net> wrote in message
news:d10dd1b6.0407190412.104bb5dd@.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
No comments:
Post a Comment