sql插入新的一列报错,求助

“student”表

  • 无法修改表。 Cannot insert the value NULL into column 'authority', table 'studentssystem.dbo.Tmp_student'; column does not allow nulls. INSERT fails. The statement has been terminated.

看报错提示就是说你authority这一栏数据不能为空,你插入的数据中是不是这栏有空数据?

该属性不允许为空值。

列authority属性不允许为空,而你插入了空值。

很明显你插入的值是不允许为空的

你修改表结构新增 authority 列,如果该列不能为空,要指定一个默认值,这样已有记录会用默认值而不是 NULL 填充新增列,否则就会报不能为空的错误。