Error... Invalid object name 'data1'.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rockie12

    Error... Invalid object name 'data1'.

    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 ('AdminManageLo gIn','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 ('AdminManageLo gIn','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
  • Allan Mitchell

    #2
    Re: Error... Invalid object name 'data1'.

    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" <rockie12@dtnsp eed.net> wrote in message
    news:d10dd1b6.0 407190412.104bb 5dd@posting.goo gle.com...[color=blue]
    > 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 ('AdminManageLo gIn','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 ('AdminManageLo gIn','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[/color]


    Comment

    • Simon Hayes

      #3
      Re: Error... Invalid object name 'data1'.


      "rockie12" <rockie12@dtnsp eed.net> wrote in message
      news:d10dd1b6.0 407190412.104bb 5dd@posting.goo gle.com...[color=blue]
      > 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 ('AdminManageLo gIn','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 ('AdminManageLo gIn','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[/color]

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

      insert into data1 (AdminManageLog In,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 (AdminManageLog In,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


      Comment

      Working...