babu_puchakayala
asked on
change stored procedure
I have a proc that print checks if there is any new checks to be print. If there is nothing to issue new checks it wont print any. Now i want to modify this proc like even if i don't have any new checks to be print, it should pick up at least one check to be print.( even if it is already printed). Can you tell me how to do that. Here is the stored proc.
CREATE PROCEDURE [proc_1250_SELCashiersChec ksForPrint ] ASSELECT t_DATA_CashiersChecksIssue d.ControlN br,
t_DATA_CashiersChecksIssue d.Audit_Da teAdded,
t_DATA_CashiersChecksIssue d.BatchNbr ,
t_DATA_CashiersChecksIssue d.SerialNb r,
t_DATA_CashiersChecksIssue d.CheckRTN ,
t_DATA_CashiersChecksIssue d.CheckAcc ountNbr,
t_DATA_CashiersChecksIssue d.Amount,
t_DATA_CashiersChecksIssue d.DateIssu ed,
t_DATA_CashiersChecksIssue d.Payee,
t_DATA_CashiersChecksIssue d.Address,
t_DATA_CashiersChecksIssue d.City,
t_DATA_CashiersChecksIssue d.State,
t_DATA_CashiersChecksIssue d.Zip,
t_DATA_Reclamation.ClaimId ,
t_DATA_Reclamation.NoticeD ate,
t_DATA_Reclamation.FirstNa me,
t_DATA_Reclamation.MiddleN ame,
t_DATA_Reclamation.LastNam e,
t_DATA_Reclamation.ClaimTo tal,
t_PCD_Claimant.Name AS Agency,
t_DATA_CashiersChecksIssue d.IDENTITY COL FROM t_DATA_CashiersChecksIssue d
INNER JOIN
t_DATA_Reclamation
ON
t_DATA_CashiersChecksIssue d.ControlN br = t_DATA_Reclamation.Control Nbr
INNER JOIN
t_PCD_Claimant ON t_DATA_Reclamation.Claiman tCode = t_PCD_Claimant.ClaimantCod e
WHERE
(t_DATA_CashiersChecksIssu ed.SerialN br IS NULL) AND (t_DATA_CashiersChecksIssu ed.DateIss ued IS NULL)ORDER BY t_DATA_CashiersChecksIssue d.Audit_Da teAdded ASC, t_DATA_CashiersChecksIssue d.ControlN br ASC
CREATE PROCEDURE [proc_1250_SELCashiersChec
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_CashiersChecksIssue
t_DATA_Reclamation.ClaimId
t_DATA_Reclamation.NoticeD
t_DATA_Reclamation.FirstNa
t_DATA_Reclamation.MiddleN
t_DATA_Reclamation.LastNam
t_DATA_Reclamation.ClaimTo
t_PCD_Claimant.Name AS Agency,
t_DATA_CashiersChecksIssue
INNER JOIN
t_DATA_Reclamation
ON
t_DATA_CashiersChecksIssue
INNER JOIN
t_PCD_Claimant ON t_DATA_Reclamation.Claiman
WHERE
(t_DATA_CashiersChecksIssu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>Now i want to modify this proc like even if i don't have any new checks to be print, it should pick up at least one check to be print.( even if it is already printed). Can you tell me how to do that.
dont you think the above join will pick one which is already printed, if not please give me the logic
dont you think the above join will pick one which is already printed, if not please give me the logic
ASKER
aneeshattingal,
if @@rowcount=0
what does it mean? i did nt understand "@@". the extra query that you gave, do i need to put in program or do you want me to create another procedure nad call that one after first procedure using if else condition.
Sorry, this question may be looks like foolish for you. But not for me. I am not expert dude. Pls let me know.
Thanks in advance.
if @@rowcount=0
what does it mean? i did nt understand "@@". the extra query that you gave, do i need to put in program or do you want me to create another procedure nad call that one after first procedure using if else condition.
Sorry, this question may be looks like foolish for you. But not for me. I am not expert dude. Pls let me know.
Thanks in advance.
@@rowcount returns the no of rows affected by the immediate statement above that...
ASKER
it didnt work. the query that you gave is same as what i have right.