为什么 PRINT 不会产生结果
Why PRINT won't produce the results
我正在编写一个存储过程来解决项目 Euler 的问题 2,打印语句不会打印结果。我试过使用 select 但它也不起作用。我到处都放了打印语句,看看有没有 运行。我已经在 Visual studio 中测试了这段代码(当然是 C# 形式)并且它 运行s 所以我不认为这是代码的任何想法?
USE [johnsodx]
GO
/****** Object: StoredProcedure [dbo].[kibonacci] Script Date: 11/10/2020 10:16:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
Create PROCEDURE Fibonacciss
AS
DECLARE @f0 INT
DECLARE @f1 INT
DECLARE @fcom INT
DECLARE @f_sum INT
SET @f0 = 1
SET @f1 = 1
SET @fcom = 0
SET @f_sum = 0
set statistics time on --Keeps track of the time it takes to excute query
Print @f_sum
while @fcom <= 4000000
BEGIN
set @fcom = @f0 + @f1;
if (@fcom % 2 = 0)
set
@f_sum += @fcom;
set @f0 = @f1;
set @f1 = @fcom;
Print @f_sum
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
-- Insert statements for procedure here
Print @f_sum
Print @fcom
END
Print @f_sum
我很笨,不知道 execution: creating 和 运行 it
的区别
我正在编写一个存储过程来解决项目 Euler 的问题 2,打印语句不会打印结果。我试过使用 select 但它也不起作用。我到处都放了打印语句,看看有没有 运行。我已经在 Visual studio 中测试了这段代码(当然是 C# 形式)并且它 运行s 所以我不认为这是代码的任何想法?
USE [johnsodx]
GO
/****** Object: StoredProcedure [dbo].[kibonacci] Script Date: 11/10/2020 10:16:46 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
Create PROCEDURE Fibonacciss
AS
DECLARE @f0 INT
DECLARE @f1 INT
DECLARE @fcom INT
DECLARE @f_sum INT
SET @f0 = 1
SET @f1 = 1
SET @fcom = 0
SET @f_sum = 0
set statistics time on --Keeps track of the time it takes to excute query
Print @f_sum
while @fcom <= 4000000
BEGIN
set @fcom = @f0 + @f1;
if (@fcom % 2 = 0)
set
@f_sum += @fcom;
set @f0 = @f1;
set @f1 = @fcom;
Print @f_sum
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
-- Insert statements for procedure here
Print @f_sum
Print @fcom
END
Print @f_sum
我很笨,不知道 execution: creating 和 运行 it
的区别