新建表的语句
use master
go
create database BookStore
go
use BookStore
go
create table B_User
(
U_id int identity(0000,1) primary key not null,
U_Name varchar(30) not null,
U_Pswd varchar(30) not null,
U_Email varchar(50) not null
)
go
插入测试数据:
use BookStore
go
insert into B_User(U_Name)
values('smile')
报错:
原因:在设计数据库时,因为建立的列,不止一个是NOT NULL
因此在插入测试数据时,要把所有定义为NOT NULL的数据填写完整!
修改:
insert into B_User(U_Name,U_Pswd,U_Email)
values('Smile','Smile','Smile@Smile.com')
结果: