Need Help For Identity

  • Hi Guys,

    We are using SQL Server 2000 as our database. We are having Employee Table with more than 1 million records. We are having fields empid,empfname,emplname,dob,.. etc . Here empid is the primary key with identity(1,1).

    Accidentally the employee table has lost its identity and primary key . Is there anyway to bring back those settings without affecting the already existing data ? .

    Thanks In Advance

    Jerish

    dess@satyam.net.in

  • You should be able to add back but it may have some effect on the current data especially if the field has any nulls and the PK is clustered index. I would suggest doing this ASAP but not in the middle of a high transaction period.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Hello Anteras,

    At present nobody is using the database . How can we bringback the primary key and identity ? Is there any T-SQL to do this ?

    Thanks

    Jerish

    dess@satyam.net.in

  • Too many variable to do this in TSQL as the column will have to be added and the old dropped to create a Column defined as IDENTITY(1,1) and PRIMARY KEY. Your best bet is EM since it will handle all the bits and pieces for you.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

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

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