0

Hello the following is schema of the table in question

  • employee (emp_no,emp_fname,emp_lname,birth_date,residence)

The emp_no is INT and is a primary key. Currently there are random big numbers in the column as IDs and I need to reset the column and make it so that it adds the autoincremented ID to the existing entries plus to every new entry I will add.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Pavel Kašelják
  • 351
  • 3
  • 17
  • 2
    Your question is not very clear. Are you wanting to change the current values? I would consider reseeding your identity so it starts with a value larger than the largest current value. If you change the existing values you may very likely run into problem with foreign keys. – Sean Lange Jan 05 '15 at 16:11
  • See: http://stackoverflow.com/questions/21824478/reset-identity-seed-after-deleting-records-in-sql-server – Jason Faulkner Jan 05 '15 at 16:12
  • Good point. If you post it as an answer with the SQL I will flag it as a correct one. Yes I wanted to change the current entries but I think I brainfarted as I didnt considered the foreign keys. – Pavel Kašelják Jan 05 '15 at 16:13
  • Just modify the answer posted by Andrea slightly so it uses the largest current value + 1 and you should be good to go. – Sean Lange Jan 05 '15 at 16:26

0 Answers0