Results 1 to 5 of 5

Thread: int primary key

  1. #1
    Join Date
    May 2003
    Posts
    70

    Unanswered: int primary key

    Hi,

    I have a database that was created in SQL Server 2000 I presume, although I am not certain.
    I am used to creating primary keys on identity columns.
    This table however had the fields s_collineage, s_generation etc which I believe created for replicated databases.
    Is it safe to remove them?
    Also, the primary key in this field is an int columns with a default value of 0.
    Whenever a new record is created, that field is populated with a random int value. I don't understand how this value is generated. I checked the column properties but cannot figure it out.
    Any help would be greatly appreciated.

    MA,

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    Can you give us all the DDL scripts of this table and it fields?
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    See if there is a trigger on the table that sets the primary key value.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Stating the obvious perhaps, but have you checked that the application is not generating the PK values?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    May 2003
    Posts
    70
    I think i know why this is happening.
    This used to be an access database i believe setup for replication. When that is done all autonumbers are changed to just ints to prevent the duplicated auto incremented numbers.
    I checked the sql server database and it is not setup for replication. Maybe they just ran the wizard to upgrade to sql, not sure.
    I will just change the fields to autonumbers again and mark the relationships to cascade update.

    Thanks,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •