July 25, 2005 at 8:42 am
Hi All,
July 25, 2005 at 9:27 am
Workaround
SELECT * INTO #Result
'Your Query with COMPUTE BY'
SELECT * FROM #Result
SELECT * INTO #Result
'Your Query with Rollup'
Edit/delete and update #Result
SELECT * FROM #Result
Regards,
gova
July 25, 2005 at 9:34 am
it is not very difficult to work with more than one result set just make sure that when you are done with one you call NextRecordSet from the ADO recorset object or NextResult from the DataReader in ADO.NET!
Now the solution from TSQL perpective is to use WITH ROLLUP clause after the group by. Have alook at it in BOL
* Noel
July 25, 2005 at 9:48 am
Hi Noel,
Thanks for your reply. but the prob is actually i should show this in a datagrid object in asp.net.
Also the data is very huge. I have tried rollup, but the output has extra records for null case.
cant we work on the resultsets in the sql and get a single result set. is it possible.
July 25, 2005 at 9:57 am
Hi govinn,
Thanks for your reply.
SELECT * INTO #Result
'Your Query with COMPUTE BY'
SELECT * FROM #Result
but i am getting an error.
Insert Error: Column name or number of supplier values does not match table definition.
have you tried the above query.
July 25, 2005 at 9:58 am
>> I have tried rollup, but the output has extra records for null case. <<
You can filter those out in your Where Clause
>>cant we work on the resultsets in the sql and get a single result set. is it possible. <<
Didn't you said that you used WITH ROLLUP? It does returns all in a single result set!
>>but the prob is actually i should show this in a datagrid object in asp.net<<
What is the big deal? You are returning two sets of completly different data if you bind one result set to one grid and the other to another you are done! or better yet, if you store them in a dataset with the Appropriate relations then a single bind will be necessary
* Noel
July 25, 2005 at 10:09 am
I thougt I used rollup in my reply.
try
SELECT * INTO #Result
'Your Query with Rollup'
Edit/delete and update #Result
SELECT * FROM #Result
Or you can merge the multiple datatables into one datatable in the front end before binding the data to the datagrid.
Regards,
gova
July 25, 2005 at 10:11 am
hi,
there is no chance for creating relations, because we will only get different groups of data. and i have to show only in one grid.
July 25, 2005 at 11:36 am
Rajesh,
If you are going to use only one grid why do you need the record count in a compute by?
or is it that the record count should be another column?
* Noel
July 26, 2005 at 8:37 am
Hi Noel,
I want only in one grid and i want the count of records in each group because the CLIENT wants it that way.
actually this data in datagrid is then exported into excel.
July 26, 2005 at 8:37 am
Hi Noel,
I want only in one grid and i want the count of records in each group because the CLIENT wants it that way.
actually this data in datagrid is then exported into excel.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply