SQL 创建存储、触发器

2019-10-16 07:59:23

一、创建存储过程


--创建名为 GetStuCou 的无参数存储过程

create procedure GetStuCou

as

begin

    select * 

    from Student s

    left join Course c on s.C_S_Id=c.C_Id

end


--执行名为 GetStuCou 的无参数存储过程

execute GetStuCou



二、创建触发器

create trigger  触发器名称

on [dbo].[表]

for insert  ----(类型)

as 

  update 表 set 字段 = '21'

  where 字段 = ' '

  

推荐新闻