Link to home
Start Free TrialLog in
Avatar of babu_puchakayala
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_SELCashiersChecksForPrint] ASSELECT t_DATA_CashiersChecksIssued.ControlNbr,    
t_DATA_CashiersChecksIssued.Audit_DateAdded,    
t_DATA_CashiersChecksIssued.BatchNbr,    
t_DATA_CashiersChecksIssued.SerialNbr,    
t_DATA_CashiersChecksIssued.CheckRTN,    
 t_DATA_CashiersChecksIssued.CheckAccountNbr,    
t_DATA_CashiersChecksIssued.Amount,    
t_DATA_CashiersChecksIssued.DateIssued,    
t_DATA_CashiersChecksIssued.Payee,    
t_DATA_CashiersChecksIssued.Address,    
t_DATA_CashiersChecksIssued.City,    
 t_DATA_CashiersChecksIssued.State,    
 t_DATA_CashiersChecksIssued.Zip,    
t_DATA_Reclamation.ClaimId,    
t_DATA_Reclamation.NoticeDate,    
t_DATA_Reclamation.FirstName,    
t_DATA_Reclamation.MiddleName,    
 t_DATA_Reclamation.LastName,    
t_DATA_Reclamation.ClaimTotal,    
t_PCD_Claimant.Name AS Agency,    
t_DATA_CashiersChecksIssued.IDENTITYCOL FROM  t_DATA_CashiersChecksIssued
INNER JOIN    
t_DATA_Reclamation
ON    
t_DATA_CashiersChecksIssued.ControlNbr = t_DATA_Reclamation.ControlNbr    
 INNER JOIN    
t_PCD_Claimant ON     t_DATA_Reclamation.ClaimantCode = t_PCD_Claimant.ClaimantCode
WHERE
(t_DATA_CashiersChecksIssued.SerialNbr IS NULL) AND (t_DATA_CashiersChecksIssued.DateIssued IS NULL)ORDER BY t_DATA_CashiersChecksIssued.Audit_DateAdded ASC,          t_DATA_CashiersChecksIssued.ControlNbr ASC
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of babu_puchakayala
babu_puchakayala

ASKER

aneeshattingal,

it didnt work. the query that you gave is same as what i have right.
>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
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.
@@rowcount  returns the no of rows affected by the immediate statement above that...