储存过程

创建存储过程

if exists (select * from sysobjects where id= object_id('prGetMenu') and objectproperty (id, 'isProcedure') =1 )
drop procedure prGetMenu
GO

create procedure prGetMenu
  @intMenuid int = 38,
  @name varchar(24) output
as
  declare @menuid int
  select @menuid= min(id) from menu
  select @name = name from menu where id = @menuid
  return @intmenuid
GO

 

执行过程

declare @menuname varchar(24)
declare @num int
execute @num=prGetMenu @name=@menuname out
select @menuname menuname, @num number

查询储存过程

sp_stoed_procedures

select * from sysobjects where xtype='P'

查看储存过程内容

exec sp_helptext  prGetMenu

 

你可能感兴趣的:(过程)