ALTER TABLE add identity column generates duplicate values?

  • Hi everybody,

    I'm seeing something very strange here today...I typically use the "alter table add newcol int not null identity(1,1)" paradigm when the user needs to add a new column on an existing table that will be used for a PK.

    This has always worked before, but now on one particular server the new column is sprinkled with duplicate values. The number of duplicates and the rows that are duplicated changes everytime. I have never seen this before...has anybody else? I can only recreate this on this one particular 2005 server.

    I've googled and found nothing and suspect it's a bug on the server.

    Anybody else have any advice for me?

    thanks!

    Dennis

    EDIT:

    The server is running sql server 2005 9.00.1399.06 RTM...

    Maybe if they install the latest SP it will fix it...but it would be interesting to hear if anybody has seen this.

  • It shouldn't matter, but are you just running this script, or is someone changing this in the GUI? It's possible that there is a bug in the script being generated. You can check this in SSMS if you make the change and click the script icon instead of saving the change.

  • Steve Jones - SSC Editor (12/6/2010)


    It shouldn't matter, but are you just running this script, or is someone changing this in the GUI? It's possible that there is a bug in the script being generated. You can check this in SSMS if you make the change and click the script icon instead of saving the change.

    No, this is a script from an .sql file. I have also recreated this manually in Enterprise Manager with hand-made scripts that perform the same thing. I noticed that they are running in 80 compatibility mode, so maybe that combined with the RTM version is buggy...I have not been able to recreate this on SP2 and later...

  • I am also facing the same problem in the server. This has never happened before. Is it because of some microsoft update installed recently.

    -CT

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

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