存储过程和触发器

存储过程:
1创建存储过程
create procedure author_infomation
as
select ............
GO
2、执行
use pubs
Go
authors_infomation   存储过程名
GO

与这个相同
use pubs
execute/(exec) authors_infomation   存储过程名
GO
3、删除存储过程
drop procedure authors_infomation
GO
4、修改存储过程
alter procedure authors_infomation


触发器:它是建立在表或者视图的基础之上的存储过程。

1、创建
create trigger tr_works_delete on works///(products )是表或者视

for update
as
declare  @count int
select @count = count(*)
from works

update works_count
set person_count = @count
Go
2、管理
sp_helptrigger table_name,[type]//[type]有三种:insert、update、delete
来浏览指定表格上,指定类型的触发器的信息。
3、删除
drop triggter 触发器名字
4、修改
alter trigger triggter_name
on table
....

 

posted on 2006-10-12 21:11  icefeeling  阅读(60)  评论(0)    收藏  举报

导航