GO
-- =============================================
-- Author: aebea
-- Create date: 05/13/2011
-- Description: returns recordset based on parameters
-- =============================================
ALTER PROCEDURE [dbo].[sp_getRecIdsForProcessing]
-- Add the parameters for the stored procedure here
@act varchar(50),
@beginDate datetime,
@endDate datetime,
@processStep int,
@Rowcount int output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @firstDate as datetime
DECLARE @lastDate as datetime
SET @firstDate = (SELECT CONVERT(DATETIME,@beginDate,101))
SET @lastDate = (SELECT CONVERT(DATETIME,@endDate,101))
-- Insert statements for procedure here
if @act = '*'
begin
SELECT tbl_ProcessTracking.RecID, tbl_ProcessTracking.OnThisProcStep, tbl_ProcessTracking.AsOf, tbl_MasterFile.PDFName, tbl_MasterFile.Act,
tbl_MasterFile.ActDate, tbl_MasterFile.FS_Name, tbl_MasterFile.DateReceived, tbl_MasterFile.CaseID, tbl_MasterFile.SheetComment,
tbl_MasterFile.Del_Rec
FROM tbl_MasterFile INNER JOIN
tbl_ProcessTracking ON tbl_MasterFile.RecID = tbl_ProcessTracking.RecID
WHERE [ActDate] between @firstdate and @lastdate
and [OnThisProcStep]=@processStep-1
end
else
begin
SELECT tbl_ProcessTracking.RecID, tbl_ProcessTracking.OnThisProcStep, tbl_ProcessTracking.AsOf, tbl_MasterFile.PDFName, tbl_MasterFile.Act,
tbl_MasterFile.ActDate, tbl_MasterFile.FS_Name, tbl_MasterFile.DateReceived, tbl_MasterFile.CaseID, tbl_MasterFile.SheetComment,
tbl_MasterFile.Del_Rec
FROM tbl_MasterFile INNER JOIN
tbl_ProcessTracking ON tbl_MasterFile.RecID = tbl_ProcessTracking.RecID
WHERE [ActDate] between @firstdate and @lastdate
and [Act] = @act
and [OnThisProcStep]=@processStep-1
end
set @rowcount = @@rowcount
RETURN @@rowcount
END
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE