We help IT Professionals succeed at work.

change stored procedure

236 Views
Last Modified: 2013-11-16
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
Comment
Watch Question

Database Consultant
CERTIFIED EXPERT
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
aneeshattingal,

it didnt work. the query that you gave is same as what i have right.
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:
>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

Author

Commented:
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.
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:
@@rowcount  returns the no of rows affected by the immediate statement above that...
 
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.