sql server数据建表
use edudb
go
if exists(select * from sysobjects where name='department')
drop table department
create table department(
id int identity(1,1) primary key,
name varchar(20) not null,
user_id int not null,
user_name varchar(20) null,
note text null,
status int null
)
go
if exists(select * from sysobjects where name='departmember')
drop table departmember
create table departmember(
id int identity(1,1) primary key,
department_id int not null,
user_id int not null,
user_name varchar(20) null,
role int null,
status int null
)
go
if exists(select * from sysobjects where name='division')
drop table division
create table division(
id int identity(1,1) primary key,
name varchar(20) not null,
user_id int not null,
user_name varchar(20) null,
note text null,
status int null
)
go
if exists(select * from sysobjects where name='divisionmember')
drop table divisionmember
create table divisionmember(
id int identity(1,1) primary key,
division_id int not null,
user_id int not null,
user_name varchar(20) null,
role int null,
status int null
)
go
if exists(select * from sysobjects where name='class')
drop table class
create table class(
id int identity(1,1) primary key,
name varchar(20) not null,
grade int not null,
master_id int null,
master_name varchar(20) null,
master_tel char(20) null,
status int null
)
go
if exists(select * from sysobjects where name='user')
drop table [user]
create table [user](
id int identity(1,1) primary key,
name varchar(20) not null,
birth decimal(17,6) not null,
avatar varchar(100) null,
auth_id int null,
nick varchar(50) not null,
pwd varchar(50) not null,
lastlogin decimal(17,6) not null,
lastip char(20) not null,
addtime decimal(17,6) not null,
status int null
)
go
if exists(select * from sysobjects where name='auth')
drop table [auth]
create table [auth](
id int identity(1,1) primary key,
name varchar(20) not null,
code varchar(100) null,
status int null
)
go
if exists(select * from sysobjects where name='teacher')
drop table [teacher]
create table [teacher](
id int identity(1,1) primary key,
user_id int not null,
realname char(20) not null,
workno char(20) not null,
avatar varchar(100) null,
certype int not null,
cerno varchar(50) not null,
sex tinyint not null,
birth decimal(17,6) not null,
status int not null,
nation char(20) not null,
domicile char(20) not null,
birthloca varchar(100) not null,
speciality char(20) not null,
degree char(20) not null,
graduatetime decimal(17,6) not null,
graduateschool varchar(100) not null,
langtype tinyint not null,
langlevel tinyint not null,
worklevel tinyint not null,
chineselevel tinyint not null,
proftype tinyint not null,
party char(20) not null,
partytime decimal(17,6) not null,
curhow varchar(50) not null,
curway varchar(50) not null,
curtime decimal(17,6) not null,
worktime decimal(17,6) not null,
enroltime decimal(17,6) not null,
flag1 tinyint not null,
flag2 tinyint not null,
flag3 tinyint not null,
flag4 tinyint not null,
flag5 tinyint not null,
teachtime decimal(17,6) not null,
retiretime decimal(17,6) not null,
level tinyint not null,
positionlevel tinyint not null,
managetype tinyint not null,
position char(20) not null,
type1 int not null,
type2 int not null,
appleid char(50) not null,
address varchar(100) not null,
tel varchar(50) not null,
mobile varchar(50) not null,
qq char(20) null,
email varchar(50) not null,
bank1 varchar(50) not null,
bank1no varchar(50) not null,
bank2 varchar(50) not null,
bank2no varchar(50) not null,
healthcard varchar(50) not null,
division_id int not null,
division_name varchar(50) not null,
department_id int not null,
department_name varchar(50) not null
)
go
if exists(select * from sysobjects where name='semester')
drop table [semester]
create table [semester](
id int identity(1,1) primary key,
startime decimal(17,6) not null,
endtime decimal(17,6) not null,
name varchar(20) null,
year char(20) null,
ord int null,
status int null
)
go
if exists(select * from sysobjects where name='course')
drop table [course]
create table [course](
id int identity(1,1) primary key,
name varchar(20) not null,
belong int not null,
score tinyint not null,
max char(20) null,
min char(20) null,
status int null
)
go
这里用到了创建数据表,删除数据表,字段类型等知识
sql server数据建表的更多相关文章
- SQL SERVER 生成建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_MSSQL] Script Date: 06/15/2012 11:59:00 ***** ...
- (转)SQL SERVER 生成建表脚本
https://www.cnblogs.com/champaign/p/3492510.html /****** Object: StoredProcedure [dbo].[GET_TableScr ...
- 在SQL SERVER中获取表中的第二条数据
在SQL SERVER中获取表中的第二条数据, 思路:先根据时间逆排序取出前2条数据作为一个临时表,再按顺时排序在临时表中取出第一条数据 sql语句如下: select top 1 * from(se ...
- 快速查看SQL Server 中各表的数据量以及占用空间大小
快速查看SQL Server 中各表的数据量以及占用空间大小. CREATE TABLE #T (NAME nvarchar(100),ROWS char(20),reserved varchar(1 ...
- [SQL]SQL Server数据表的基础知识与增查删改
SQL Server数据表的基础知识与增查删改 由张晨辉(学生) 于19天 前发表 | 阅读94次 一.常用数据类型 .整型:bigint.int.smallint.tinyint .小数:decim ...
- 使用Spark加载数据到SQL Server列存储表
原文地址https://devblogs.microsoft.com/azure-sql/partitioning-on-spark-fast-loading-clustered-columnstor ...
- SQL Server数据表设计编辑后无法保存处理办法
关于使用 SQL Server 企业管理器,表[设计]界面,修改数据表字段或类型无法保存的问题处理过程: 使用SQL Server数据库的你是否遇到过每次数据库编辑工具内点击设计修改表字段或类型要保存 ...
- SQL SERVER数据库的表中修改字段的数据类型后,不能保存
在数据库里面建了一个表,可是由于对SQL SERVER的建表功能不熟悉,不知道把主键设成什么是好,就先设置了个TEXT类型,可是后来朋友们告诉我说,TEXT类型容易让数据文件变得很大,还 是改成一 ...
- MS SQL SERVER搜索某个表的主键所在的列名
原文:MS SQL SERVER搜索某个表的主键所在的列名 SELECT SYSCOLUMNS.name FROM SYSCOLUMNS,SYSOBJECTS,SYSINDEXES,SYSINDEX ...
随机推荐
- GDKOI2015
problems http://gdoi.sysu.edu.cn/wp-content/uploads/2015/03/GDKOI-2015-day1.pdf http://gdoi.sysu.edu ...
- Computer Graphics Thinking–texture tiling
Here is one question: how to tile texture? One thing worth to notice: The DirectX and OpenGL stipula ...
- Bootstrap--本地安装使用
1.到官网下载:http://v2.bootcss.com 2.下载后是一个压缩文件,把它放在相应的工作目录下,然后解压. 3.新建一个测试文件,然后导入两个文件.
- BootStrap学习之先导篇——响应式网页
Bootstrap学习之前,要知道响应式网页的原理. 1.什么是响应式网页? 一个页面,可以根据浏览设备的不同,以及特性的不同,而自动改变布局.大小等.使得在不同的设备上上都可以呈现优秀的界面. 优点 ...
- mysql学习之五:sql语句学习3
好吧,大家认为这样的字体还是比較好看,全部我们就换这样的字体了. INSERT INTO 语句用于向表格中插入新的行. 语法 INSERT INTO 表名称 VALUES (值1, 值2,....) ...
- 操作系统——IO缓存技术
一.为什么引入缓存技术 为了解决cpu速度和外部设备速度不匹配的问题. 降低了io对cpu的中断的次数.每进行一次IO设备的时间都非常长,所以把数据先放入缓冲区,再进行IO操作. 二.缓冲技术的实现 ...
- jquery之onblur事件
onblur事件与html结合 function discountCheck(){ //var checkVal=$('input:text[name="Fee1"]').val( ...
- Asp.Net HttpApplication 事件汇总
Global.asax 文件,有时候叫做 ASP.NET 应用程序文件,提供了一种在一个中心位置响应应用程序级或模块级事件的方法.你可以使用这个文件实现应用程序安全性以及其它一些任务.下面让我们详细看 ...
- SQL Server2008知识点总结
1.SQL Server2008基本服务及功能 2.管理SQL Server2008安全:登录.权限.数据库用户.管理角色.服务器角色.管理数据库角色. 3.数据库管理.表管理(临时表和系统表.列值属 ...
- 嵌入式开发——boa服务器下的ajax与cgi通信
博主最近在最有做一个嵌入式课程设计,要求是利用基于cortax a8的物联网实验箱做一个简单的嵌入式网页交互系统作为课程设计来验收评分.因为本身自己是学前端的,所以网页部分并不是重点,主要是和boa服 ...