create table ASD
(
Aid int primary key identity,
Aname varchar(20),
Aprice int,
Asum int ,
Aremark varchar(max)
)
go
create proc All_Proc
(
@Action varchar(20),
@Aid int ,
@Aname varchar(20),
@Aprice int,
@Asum int,
@Aremark varchar(max)
)
as
begin
if(@Action=‘Insert’) --添加
begin
insert into ASD values(@Aname,@Aprice,@Asum,@Aremark)
end
if(@Action=‘Update’) --修改
begin
update ASD set Aname=@Aname,Aprice=@Aprice,Asum=@Asum,Aremark=@Aremark where Aid=@Aid
end
if(@Action=‘Delete’) --删除
begin
delete from ASD where Aid=@Aid
end
if(@Action=‘Selx’) --查询
begin
select * from ASD where Aid=@Aid or Aname like (’%’+@Aname+’%’)
end
end
Sql Server一个存储过程实现增删改查
猜你喜欢
转载自blog.csdn.net/qq_45244974/article/details/103574865
今日推荐
周排行