0

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"
1
  • If my answer below is the correct solution, please accept this as the accepted answer. Thanks! Commented May 7, 2013 at 20:16

1 Answer 1

2

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.