In SQL Server 2016 Express, I initially made a table with a primary key that used the int datatype. Now, further into the project, I've realized that I need this column to be a string datatype, but when I try this:
alter table ExpAwbs
drop constraint PK_ExpAwbs;
alter table ExpAwbs
alter column idExpAwbs varchar(12);
alter table ExpAwbs
add constraint PK_ExpAwbs primary key (idExpAwbs);
I get this
Msg 4902, Level 16, State 1, Line 1
Cannot find the object "ExpAwbs" because it does not exist or you do not have permissions.
Is it possible to do what I'm trying to do on a temporal table, or do I need to remake the table?
Try this :
Use YourDatabaseName
Go
alter table ExpAwbs
drop constraint PK_ExpAwbs;
alter table ExpAwbs
alter column idExpAwbs varchar(12);
alter table ExpAwbs
add constraint PK_ExpAwbs primary key (idExpAwbs);
If this not working that mean that the user do not have permissions, So you have to change the user or Grant
the permission for that user.