标签:ar 使用 for on 文件 数据 ad as 数据库
视图:只能查询使用,不能新增数据和修改数据
把一个查询结果当做一个虚拟表
select *from (xunibiao) as xunibiaoming where 条件
修改视图
alter view shitu1
as
select *from studento
删除视图
drop view shitu1
触发器
---触发器---特殊的存储过程。通过增删改数据库表来自动引发
create trigger TR_student_insert
on student--在哪个表上建立触发器
for insert--for是新增之后触发,for还可以写成after——在什么什么之后触发
as
begin
select *from student
end
go
insert into student values()--括号是文件中的所有列
create trigger TR_student_delete
on student
instead of delete
as
begin
declare @sno int
select @sno=sno from deleted
delete from
end
go
delete from student
select *from student
create trigger TR_student_delete
on student
instead of delete
as
begin
select *from deleted--deleted 是临时表来获取数据
end
go
标签:ar 使用 for on 文件 数据 ad as 数据库
原文地址:http://www.cnblogs.com/liuyuwen900326/p/4149115.html