是个多主键的数据表
想把他从varchar(50)变成16
但是用这段语句
alter table pudb.[PPU01].[PU011]
ALTER COLUMN chpart VARCHAR(16)
会产生错误
Msg 5074, Level 16, State 1, Line 1
The object 'PK_PU011' is dependent on column 'chpart'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE ALTER COLUMN chpart failed because one or more objects access this column.
alter table 表名
drop CONSTRAINT 主键约束
alter table 表名
alter column 字段1 varchar(16)not null
alter table 表名
add CONSTRAINT 主键约束 primary key(字段1,字段2)
有外键约束? 要先删除约束