SQL server存储过程
作者:互联网
注意:
①先执行go之前的代码
②蓝色字体为创建的存储过程名称
③创建后,在数据库中“可编辑性”下的“存储过程”下可以找到
-----------------------------------------------存储过程
--无参数查询
create proc SelectMothod
as
select * from 表名
go
exec SelectMothod
--单参数查询
create proc SelectMothodDan
@songname nvarchar(50)
as
select * from 表名 where SongName=@songname
go
exec SelectMothodDan 我的天空
--单参数删除数据
create proc DeleteFangFa
@SGuId char (32)
as
delete from 表名 where SGuId=@SGuId
go
exec DeleteFangFa '0dfca279-c604-4142-a2e6-9c8749bf'
--------------------------------------------------------多参数添加存储过程
create proc InsertMothod
@SGuId char(32),
@SongName nvarchar(50)
as
insert into 表名 (SGuId,SongName) values (@SGuId,@SongName)
go
exec InsertMothod '18abcc52-497b-481d-b2b3-c0123456','111111'
--------------------------------------------------------更新语句存储过程
create proc UpdateMothod
@SGuId char(32),
@SongName nvarchar(50),
@Song nvarchar(MAX),
@Singer nvarchar(50),
@SongType int,
@UserID nchar(10),
@UploadTime datetime,
@OnAndOffShif int
as
update 表名 set SongName=@SongName,Song=@Song,Singer=@Singer,SongType=@SongType,UserID=@UserID,UploadTime=@UploadTime,OnAndOffShif=@OnAndOffShif where SGuId=@SGuId
go
exec UpdateMothod '0e0a9f1d-62a9-434d-b7e2-8d97958d','name','sss','sss',11,'11','2020-08-10 23:31:05.000',111
标签:存储,create,表名,SGuId,server,SQL,go,proc,SongName 来源: https://blog.csdn.net/weixin_44831306/article/details/111937467