Insert into a table that has identity column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhavi123
    New Member
    • Jun 2007
    • 4

    Insert into a table that has identity column

    Hi All,

    I have a to insert a set of rows into a table which is on some other server, and that table has an identity column which is also a primary key of that column.

    I am getting the error 'Table 'myremoteserver .myremotedataba se.dbo.myremote table' does not exist or cannot be opened for SET operation' if the statement
    SET IDENTITY_INSERT 'myremoteserver .myremotedataba se.dbo.myremote table' on
    is written before the insert statement.

    Also If I dont include that column in the select statement which is after insertion, I get the following error message "Insert Error: Column name or number of supplied values does not match table definition.
    "

    Can someone please help me how to solve this problem.

    Thank you.
  • kestrel
    Recognized Expert Top Contributor
    • Jul 2006
    • 1071

    #2
    I am moving this to the Forum.

    --
    Kestrel

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Before inserting records ,please check table defination(stru cture) properly.

      Both should match.

      Comment

      • jojo41300000
        New Member
        • Apr 2007
        • 32

        #4
        Originally posted by madhavi123
        Hi All,

        I have a to insert a set of rows into a table which is on some other server, and that table has an identity column which is also a primary key of that column.

        I am getting the error 'Table 'myremoteserver .myremotedataba se.dbo.myremote table' does not exist or cannot be opened for SET operation' if the statement
        SET IDENTITY_INSERT 'myremoteserver .myremotedataba se.dbo.myremote table' on
        is written before the insert statement.

        Also If I dont include that column in the select statement which is after insertion, I get the following error message "Insert Error: Column name or number of supplied values does not match table definition.
        "

        Can someone please help me how to solve this problem.

        Thank you.
        It should match the number of parameters to insert with the number of columns in table.

        Comment

        Working...