on primary
(name='library_1',
filename='C:\data\library_1.mdf',
size=5MB,
maxsize=30MB,
filegrowth=15%)
log on
(name='library_2',
filename='C:\data\library_1.ldf',
size=3MB,
maxsize=20MB,
filegrowth=15%)
use library
create table readernote
(readerno char(5) not null primary key,
unit varchar(20) not null,
name varchar(8) not null,
sex char(2) not null,
job varchar(8),
address varchar(20) not null)
insert into readernote values('00001','学校','张3','男','主任')
insert into readernote values('00002','学校','李四','男','学生',')
insert into readernote values('00003','学校','王5','女','主任')
insert into readernote values('00004','学校','赵6','男','教师')
insert into readernote values('00005','学校','徐7','女','教师')
create table book
(bookno char(8) not null primary key,
classno char(5) not null,
bookname varchar(20) not null,
author varchar(8) not null,
cbunit varchar(20) not null,
price int not null)
insert into book values('00000001','00001','计算机网络','张平','清华大学出版社',38)
insert into book values('00000002','00002','计算机组成原理','章江','清华大学出版社',35)
insert into book values('00000003','00003','计算机语言','李明','清华大学出版社',50)
insert into book values('00000004','00004','数据库设计','刘阳','清华大学出版社',32)
insert into book values('00000005','00005','专业英语','李冬','清华大学出版社',22)
create table borrow
(readerno char(5) not null,
bookno char(8) not null,
borrowdatetime datetime not null,
returndatetime datetime not null,
primary key(readerno,bookno),
foreign key(readerno)references readernote(readerno),
foreign key(bookno)references book(bookno))
insert into borrow values('00001','00000001','2011-01-02','2011-02-01')
insert into borrow values('00002','00000002','2011-02-02','2011-03-01')
insert into borrow values('00003','00000003','2011-03-02','2011-04-01')
insert into borrow values('00004','00000004','2011-04-02','2011-05-01')
insert into borrow values('00005','00000005','2011-05-02','2011-06-01')
create table librarymanager
(jobno char(3) not null primary key,
name varchar(8) not null,
sex char(2) not null,
borndatetime datetime not null,
jobname varchar(10) not null,
salary int not null)
insert into librarymanager values('001','姜某','男','1963-09-11','主任',2000)
insert into librarymanager values('002','王某','女','1964-09-11','副主任',1800)
insert into librarymanager values('003','陈某','男','1980-09-11','管理员',1500)
create login mylogin2
with password='password',
check_policy=off
create user sysadmin for login mylogin2
exec sp_addrolemember 'db_owner','sysadmin'
grant all privileges on dbo.readernote to sysadmin
with grant option
grant all privileges on dbo.borrow to sysadmin
with grant option
grant all privileges on dbo.book to sysadmin
with grant option
grant all privileges on dbo.librarymanager to sysadmin
with grant option
create login mylogin3
with password='password',
check_policy=off
create user admin1 for login mylogin3
exec sp_addrolemember 'db_owner','admin1'
create login mylogin4
with password='password',
check_policy=off
create user admin2 for login mylogin4
exec sp_addrolemember 'db_datareader','admin2'grant all privileges on dbo.readernote to admin1
grant all privileges on dbo.borrow to admin1
grant all privileges on dbo.book to admin1
revoke alter on librarymanager from admin1
grant select on borrow to admin2
create procedure st
@jobno int
As select * from librarymanager
Where jobno=@jobno
Create procedure st1
@readerno int
As select * from borrow
Where readerno=@readerno
Grant exec on st to admin1
Grant exec on st1 to admin2
exec st @jobno=01
exec st1 @readerno=00001
select * from book
应该比较接近了。你自己再改改
update wxk.dbo set ZLRQ="2010-8-9" where ZLRQ="2010-10-18" 不过这样会把所有ZLRQ="2010-8-9"都改成2010-10-18了,建议后面再and id=唯一标识列的值就是你要改的那行·你如果要全部改就不需要加具体 *** 作步骤如下:
1、首先双击打开sqlserver,右击需要导入数据的数据库,如图所示。
2、点击任务,再点击任务中的导入数据选项,打开导入导出数据向导界面。
3、在向导界面点击下一步,进入下图界面依次填写需要的内容:数据源 Excel,文件路径,以及Excel版本,填好后点击下一步(如果Excel其他版本不行的话,就选择Excel97-03的,再将Excel保存为相应版本)即可。
4、然后就是目标数据库设置:目标选择msslserver,服务器名称不用变,身份验证输入相应的密码,数据库选择对应的数据库,设置好后点击下一步。
5、然后来到图示界面,直接默认选项即可,点击下一步。
6、图示界面,可以自定义目标数据库(表在数据库中可以不存在),点击预览即可以看到导入之后的表状态,如图。
7、上一步完成后再继续下一步,最后点击完成,即可导入成功,如图。
8、最后在数据库中检查一下导入的表数据,附上导入的Excel数据为例。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)