views:

48

answers:

1

I have stored proc that will tell us if there is any new checks to be printed. Now I have to manipulate the data in database table in order to get at least one check to be printed. I didn't write this query. I tried but I didn't get at least one check to be printed. Can anyone help me. HERE IS THE STORED PROC

CREATE PROCEDURE [proc_1250_SELCashiersChecksForPrint] AS

SELECT 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

GO

`

A: 

Assuming the tables have data, this will update the first row.

UPDATE TOP(1) t_DATA_CashiersChecksIssued
   SET SerialMbr = NULL,
       DataIssued = NULL
  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
Dave Barker
I DON'T WANT TO CHANGE THE PROC. i WANT TO MANIPULATE TABLES DATA (LIKE ADDING EXTRA DATA) IN ORDER TO GET ATLEAST ONE CHECK TO BE PRINTED. SO CAN YOU TELL ME WHICH TABLE OR COLUMN DATA DO I NEED TO CHANGE IN ORDER TO GET ATLEAST ONE CHECK TO BE PRINTED.
pbrp
The above SQL will manipulate the data so the stored proc will print one cheque.
Dave Barker
where do i need to execute this query? i mean in which table? i opened t_DATA_CashiersChecksIssued table in sql enterprise manager and tried to execute that one. But it didn't.
pbrp
You'll need to execute it in SQL Server Management Studio from a Query window (New Query button top left hand corner).
Dave Barker
its working dave barker. Thanks for your help.
pbrp