sql server怎么调用存储过程

如题所述

在SQL Server数据库的维护或者Web开发中,有时需要在存储过程或者作业等其他数据库操作中调用其它的存储过程,下面介绍其调用的方法

在SQL Server数据库的维护或者Web开发中,有时需要在存储过程或者作业等其他数据库操作中调用其它的存储过程,下面介绍其调用的方法
一、SQL SERVER中调用不带输出参数的存储过程
SQL 代码

--存储过程的定义
create procedure [sys].[sp_add_product]
(
@m_viewcount int = 0
,@m_hotcount int = 0
)
as
go
--存储过程的调用
declare @m_viewcount int
declare @m_hotcount int
exec sp_add_product @m_viewcount,@m_hotcount

二、SQL SERVER中调用带输出参数的存储过程

SQL 代码

--定义存储过程
create procedure [sys].[sp_add_product]
(
@m_viewcount int = 0
,@m_hotcount int output
)
--存储过程的调用
declare @m_viewcount int =0
declare @m_hotcount int
exec dbo.sp_add_product @m_viewcount,@m_hotcount output
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-10-25
调用存储过程demo(无参数的存储)
进入查询界面输入以下内容
exec demo----执行存储过程
相似回答