--事务:transtraction
begin transaction tran_name
save transaction point
if @@ERROR<>0
rollback transtraction tran_name/point
else
commit transaction trn_name
--视图,索引
create unique index indexname on tablename(field)
聚集索引:clustered
非聚集索引:nonclustered
--
--
create table tbl11
(tbid varchar(40),
tanm varchar(50),
tbag int)
---
---
循环插入记录:
while 1=1
insert into tbl11 values(newid(),'abc',rand()*60)
--创建聚集索引:
create clustered index indtb on tbl11(tbid)
--删除索引:
drop index indtb on tbl11
--
--
declare @dt datetime
set @dt=getdate()
select * from tbl11 where tbid='f'
select 'before',datediff(ms,@dt,getdate())
set @dt=getdate()
create clustered index indtb on tbl11(tbid)
select 'ing',datediff(ms,@dt,getdate())
set @dt =getdate()
select * from tbl11 where tbid='f'
select 'after',datediff(ms,@dt,getdate())
--
--
--
select * from tbl11
--
alter index indexname on tbna rebuild(重建)
alter index indexname on tbna disable(禁用)
--
drop index indexname
--view:
--建立在物理表上的虚表(逻辑表)
create view viewname
as
select from
select * from viewname
按 ** 查询
select 姓名 from 姓名试图
查询在逻辑表
HIS:(health information system)
health card number
hospital Items:name,addr,level
patients Items:id,name,gender,birth,high,weight
doctors items:id,name,class,field,patient,datetime
seeing doctor