identity_insert on

  • I have a table where one of its field is a datatype Identity(1,1)

    Table

    ( ID int PK

    Name varchar(20)

    LastName varchar(20)

    zoneID int identity(1,1)

    I need to insert more than 100 records into that table.. I already set the Identity_Insert ON, but Im still getting:

    An explicit value for the identity column in table 'aaa_uzone_all' can only be specified when a column list is used and IDENTITY_INSERT is ON.

    my query is:

    Insert into Table

    Select ID, Name, LastName, Zone ID

    from OtherTable

    Where date >= '01/01/2009'

    Any advice??

    Thank you

  • you need to list the columns you going to insert into:

    Insert into Table

    (ID ,Name ,LastName ,zoneID)

    Select ID, Name, LastName, Zone ID

    from OtherTable

    Where date >= '01/01/2009'

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • Thank you so much,

    forgot that little detail 😉

    Have a nice day 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply