I already have a table with a varchar primary key. This is working fine with my current .edmx model.
Now I added an auto-increment identity column in that table. While I try to update the .edmx, that table is not being included in .edmx.
Can't I have a varchar PK column and an auto-increment identity column in the same table?
Yes, here's an example. The identity property has nothing to do with the PK. It just won't ever be null, obviously, and increments from the seed based off what ever you set.
create table myTable ( VC varchar(64) not null
,primary key (VC)
)
insert into myTable
values
('something')
,('else')
select *
from myTable
alter table myTable
add id int identity (1,1)
insert into myTable (VC)
values
('thirdColumn')
select *
from myTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With