I imported an excel file with the data I need into Sql Server. Now I want to add a primary key using this statement:
alter table Tickets add constraint idTicket primary key (TOC);;
But I get this error:
Msg 8111, Level 16, State 1, Line 1 Cannot define PRIMARY KEY constraint on nullable column in table 'Tickets'. Msg 1750, Level 16, State 0, Line 1 Could not create constraint or index. See previous errors.
I looked but couldn't find a solution here. How can I fix this?