SQL Server中的存储过程 [英] Stored Procedures in SQL Server

查看:111
本文介绍了SQL Server中的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们是否应该在另一个存储过程中编写存储过程.任何人都可以建议我.

Hi,

Shall we write Stored procedure within the another Stored Procedure. Any one can suggest me.

推荐答案

上面的"Kankeyan's"解决方案更详细

步骤1:创建拳头程序

Futher to "Kankeyan''s" solution above bit more detailed

STEP 1 : Create the fist procedure

create procedure spProcedure1 (@id int)
as
Begin
    Select 'Procudure1 id value=' +STR (@id)

End




步骤2:创建第二个过程,第二个过程是在
中调用第一个过程




STEP 2 : Create the second procedure, Second procedure is calling the first procedure within

create procedure spProcedure2 (@id2 int)
as
Begin
    Declare @id3 int
    Select 'Procudure2 id value=' +STR (@id2)
    set @id3=@id2*2
    exec spProcedure1 @id3

End




步骤3:使用示例参数调用第二个过程




STEP 3: Call the second procedure with a sample paramter

spProcedure2 10




分析输出并希望其自我解释




Analyse the output and hope its self explanatory


YOu可以编写两个或多个存储过程,并在具有必要输入的存储过程中调用该存储过程

创建Proc示例
(
参数
)
作为
开始
有些情况
执行样品2<参数>

END


希望对您有帮助
YOu can write the two or more stored procedure and call the stored procedure in on stored procedure with necessary inputs

Create Proc Sample
(
Parameters
)
As
BEGIN
some condition
Exec sample 2 <parameter>

END


hope will it helpful


这篇关于SQL Server中的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆