(1)文章要点
A。讲解结构化存储过程的编写。
(2)在SQL server中实现结构化存储过程,我们首先需要知道用While关键字。以下我将会以代码延时怎么使用循环
CREATE PROCEDURE [dbo].[Cp_Cal]
(@Result int output)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
if @Result is null
set @Result = 1
declare @I int
set @I = 1
while @I <=10
begin
set @Result=@Result +@I
Set @I=@I+1
end
(@Result int output)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
if @Result is null
set @Result = 1
declare @I int
set @I = 1
while @I <=10
begin
set @Result=@Result +@I
Set @I=@I+1
end
执行存储过程之后,再调用存储过程,很方便,不用输入什么参数。