简体   繁体   English

具有存储过程的多表返回

[英]Multiple Table Return with Stored Procedure

I have the following stored procedure, it works fine except that when returns all the results it will start over and create another window, it is looping over and over creating table after table with the same results. 我有以下存储过程,它工作正常,但是当返回所有结果时它将重新开始并创建另一个窗口,它循环遍历创建具有相同结果的表后表。 What could be causing this? 可能是什么导致了这个?

USE [HRLearnDev]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[COL_Run_DOM_Parameters]
@StartDate varchar (50),
@EndDate varchar (50)
AS
SET NOCOUNT ON
SELECT *
FROM dbo.COL_V_GEMS_DOM_FCT
WHERE REC_EFF_STT_DT BETWEEN @StartDate and @EndDate
ORDER BY REC_EFF_STT_DT DESC

EXECUTE COL_Run_DOM_Parameters @StartDate = "2010-03-05", @EndDate = "2011-06-11"

I don't think you want to do this within your stored procedure (ie: REMOVE it): 我认为你不想在你的存储过程中这样做(即:删除它):

EXECUTE COL_Run_DOM_Parameters @StartDate = "2010-03-05", @EndDate = "2011-06-11"

This indicates the procedure is calling itself recursively, over and over and over ... 这表明程序正在递归地调用自身,一遍又一遍......

(Unless this was mistakenly included, and was just shown as an example of how you WOULD call the stored proc) (除非错误地将其包括在内,并且仅作为您将如何调用存储过程的示例显示)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM