use StudentManagement
go
if exists(select * from sysobjects where name = 'Students')
drop table Students
go
create table Students
(
StudentId int identity(10000,1) primary key,--自动标识列,系统自动生成,10000是起始值,1是递增值
StudentName varchar(20) not null,
Gender char(2) not null,
Birthday datetime not null,
StudentIdNo numeric(18, 0) not null,
Age int not null,
PhoneNumber varchar(50),
StudentAddress varchar(500),
ClassId int not null
)
go
if exists(select * from sysobjects where name = 'Students')
drop table Students
go
create table Students
(
StudentId int identity(10000,1) primary key,--自动标识列,系统自动生成,10000是起始值,1是递增值
StudentName varchar(20) not null,
Gender char(2) not null,
Birthday datetime not null,
StudentIdNo numeric(18, 0) not null,
Age int not null,
PhoneNumber varchar(50),
StudentAddress varchar(500),
ClassId int not null
)
go
简单说明:go是批处理的标志,表示SQLserver将这些SQL语句编译成一个执行单元,提高执行效率。go是SQLServer的批处理命令,只有代码编辑器才能识别并处理,编辑其他应用程序就不能使用该命令。由于每个批处理之间是独立的,因此,在一个批处理出现错误时,并不影响其他批处理中SQL代码的执行。