Hi,
I have a batch of 10 stored procedures that I am executing one after the other.
Each of these procedures accepts 3 parameters, the startdate the enddate and a flag which determines whether a table
is to be repopulated or not. If the value passed to the flag is 'Y' the table is repopulated whereas if its 'N' its not.
All my stored procedures query data from this table.
Now, if I execute this batch of stored procedures on my Development Server they give the expected results.
However, on deploying this batch to the Production server, they gave totally different results.
i.e. the number of rows did not match for the stored procedure 1 and 2.
Also, the procedures 3-7 did return give any rows whereas they do return the correct data on the development server.
The only ctach seems to be I pass the flag as 'Y' i.e. I repopulate the table when the first stored procedure runs whereas for all the others the flag is passed as 'N'.
e.g. exec [dbo]
.[spMonthlyInvChecks1] '2025-09-10', '2025-09-30', 'Y'
exec [dbo]
.[spMonthlyInvChecks2] '2025-09-10', '2025-09-30', 'N'
exec [dbo]
.[spMonthlyInvChecks3] '2025-09-10', '2025-09-30', 'N'
I have pasted the stored procedure code below :
CREATE
procedure [dbo].[spMonthlyInvoiceChecks1]
@startDate
datetime,
@endDate
datetime,
@repopulateTable
char (1) = 'N'
as
BEGIN
IF
(@repopulateTable = 'Y')
BEGIN
truncate table MonthlyChecks
insert into MonthlyChecks
select * from vChecksView
END
BEGIN
select col1, col2 etc..
from MonthlyChecks join table2
where conditions...
order by...
End
End
Go
Any help would be much appreciated.
Aryan.