sql - 为什么 PRINT 不会产生结果
问题描述
我正在研究一个存储过程来解决项目 Euler 的问题 2,并且打印语句不会打印结果。我尝试过使用 select 但它也不起作用。我到处都放了打印语句,看看是否有任何运行。我已经在 Visual Studio 中测试了这段代码(当然是 C# 形式)并且它运行了,所以我不认为它是任何想法的代码?
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
解决方案
我很笨,不知道执行之间的区别:创建和运行它
推荐阅读
- java - 用空格传递 gradle 参数
- c# - 关于 Unity 上多个渲染目标的渲染行为的问题。还是Shader的问题?
- c# - MongoDb C#:批量插入与批量更新
- ionic-framework - 如何将 Ionic Cordova 3 迁移到 Ionic Cordova 5?
- macos - 为什么我的 MacOS App Napping 尽管我指示它不要
- php - 如何在不提交的情况下在 PHP 中保存下拉列表的值?
- docker-compose - Traefik 无法使用 docker-compose 连接到服务器
- sql - SQL选择不同的一列并显示所有
- python - 未填充的“self”参数
- vim - 可视块模式下的多次删除