Re: Need Best example for tested cursors

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Roji. P. Thomas (lazydragon_at_nowhere.com)
Date: 09/05/04


Date: Sun, 5 Sep 2004 12:09:57 +0530

OK. What you are trying to write is a report, which should be done using a
report writer ;)

Still see whether this helps. (it doesnt do the fancy formatting, just
returns the required data)

--Contract Details
SELECT CASE WHEN (GROUPING([cust_no]) = 1) THEN 'Total'
  ELSE [cust_no] End AS [cust_no],
 CASE WHEN (GROUPING([contract_no]) = 1) THEN 'Total'
            ELSE [contract_no] END AS [contract_no],
 SUM([value]) As [Value],Min([date]) FROM [tab1]
GROUP BY [cust_no],[contract_no] WITH ROLLUP

--Statement of Account
SELECT CASE WHEN (GROUPING([cust_no]) = 1) THEN 'Total'
  ELSE [cust_no] End AS [cust_no],
CASE WHEN (GROUPING([ref]) = 1) THEN 'Total'
  ELSE CONVERT(VARCHAR,[ref]) End AS [ref],
Sum([amt]) as amount,Min([date])
FROM [tab2]
GROUP BY [cust_no],[ref] WITH ROLLUP

-- 
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"mohammed ahmed" <mohammedahmed1966@rediffmail.com> wrote in message
news:%23JAByypkEHA.3520@TK2MSFTNGP11.phx.gbl...
> I just followed your instruction you provided me earlier to generate DDL
> and Inserts through the link. I did not check those DDLs because I
> trusted, that those scripts would do the job correctly because you
> provided that link (vyaskn.tripod) as a person trying to help. As you
> know already that I am not SQL server savvy but you are. suggest some
> thing on how to fix that error. Or if you or aron can fix it  and move
> on to providing solution i will appreciate. other wise please consider
> this issue as "closed".
>
> thanks,
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!