最简单的存储过程
仅为个人理解,有空请参观迷恋自留地
--EXISTS用于检查子查询是否至少会返回一行数据,该子查询实际上并不返回任何数据,而是返回值True或False
--创建存储过程
create proc asd
as select * from [dbo].[t_ActivityClassify]
判断存储过程是否存在
--判断存储过程是否存在
if(exists(select * from sysobjects where name='asd'))
drop proc asd
go ----批处理
create proc asd
as
select * from [dbo].[t_ActivityClassify]
首次尝试实用markdown
执行存储过程
go ----写完存储过程记得用go
--执行存储过程
exec asd
有参数
----有参数
--判断存储过程是否存在
if(exists(select * from sysobjects where name='asd'))
drop proc asd
go ----批处理
create proc asd
@id int
as
select * from [dbo].[t_ActivityClassify] where id=@id
go ----写完存储过程记得用go
--执行存储过程
exec asd @id=1054