标签:var modify str table change 约束 color acl name
Oracle
ALTER TABLE T_USER MODIFY USERNAME VARCHAR2(18);
MySQL
ALTER TABLE T_USER CHANGE USERNAME USERNAME VARCHAR(200) NOT NULL COMMENT ‘username‘;
SQL Server
ALTER TABLE T_USER ALTER COLUMN USERNAME VARCHAR(200);
【注意】SQL Server 字段有约束或者索引,需要按如下方式处理:
1 ALTER TABLE T_USER DROP CONSTRAINT PK_T_USER; 2 ALTER TABLE T_USER ALTER COLUMN ID VARCHAR(20) NOT NULL; 3 ALTER TABLE T_USER ADD CONSTRAINT PK_T_USER PRIMARY KEY (ID);
1 ALTER TABLE T_USER DROP CONSTRAINT UN_T_USER; 2 ALTER TABLE T_USER ALTER COLUMN USERNAME VARCHAR(20); 3 ALTER TABLE T_USER ADD CONSTRAINT UN_T_USER UNIQUE (USERNAME);
1 DROP INDEX IDX_USER ON T_USER; 2 ALTER TABLE T_USER ALTER COLUMN USERNAME VARCHAR(20); 3 CREATE INDEX IDX_USER ON T_USER(USERNAME);
Oracle/MySQL/SQL Server修改表字段类型和长度
标签:var modify str table change 约束 color acl name
原文地址:https://www.cnblogs.com/EaTerLeader/p/11573695.html