用sql命令修改数据表中的一个字段为非空(not null)的语句_php技巧

WBOY
Release: 2016-05-17 09:24:59
Original
1128 people have browsed it

用sql命令修改数据表中的一个字段为非空(not null)的语句_php技巧

ALTER TABLE table1 ALTER COLUMN [name] varchar(60) NULL;

table1 表名 
name 字段名 为什么加上[],因为name是sql关键字会冲突出现错误,这样以防万一。

如果name字段已经创建了索引,如果需要修改的话,必须先删除索引才能正确的进行。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template