SQL Server 上有我的问题。我有一个命名XSGL
为管理学生信息的数据库。
首先,我创建一个名为student 表IS_Student
的视图。
CREATE VIEW IS_Student
AS SELECT sno, sname, ssex, sage
FROM student
WHERE sdept = 'IS'
WITH CHECK OPTION;
然后我想通过视图插入一个学生。
INSERT INTO IS_Student
VALUES('200215129', '赵新', '男', 20) ;
但它有一个错误:
Msg 515, Level 16, State 2, Line 1
不能将值 NULL 插入列 'sdept',表 'XSGL.dbo.student';列不允许有 Null 值。INSERT 失败。
语句已终止。
我把它翻译成英文。
You cannot insert the value NULL into the column 'sdept', the table 'XSGL.dbo.student'; the column does not allow Null values. INSERT failed.
The statement has been terminated.
该视图IS_Student
是在学生上创建的sdept
,'IS'
我也使用WITH CHECK OPTION
. 为什么错误告诉我无法将值 NULL 插入“sdept”列。
对不起我可怜的Endlish。提前致谢。