1

I have table DateDim in database northwind_warehouse. I need to add new int primary key column named 'DateID' in this table with incrementing value starting with 109574 and increasing on 1 every new row. How can i do this if i have 1000 rows in table?

Mr.Proper
  • 33
  • 5

1 Answers1

2

I think I understand you have no primary key in this table now, so you could do this

alter table DateDim add DateID int not null identity (109574, 1)
alter table DateDim add constraint PK_DateDim_ID primary key (DateID)

Click here to see it working

GuidoG
  • 11,359
  • 6
  • 44
  • 79