Author |
Topic |
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2008-03-11 : 11:28:37
|
I've been tasked with creating 150 separate reports.....the query will remain exactly the same as the requirements for each report are the same. The only difference between each is the criteria for the country. I'm looking for some guidance as to how I can pass the results of one querySELECT Country FROM Countries(One record at a time to another query)SELECT blah blah FROM blah blah WHERE Country = 'the fist record of the result set produced in the query above' and so on.I then have to export each result set to a separate worksheet within one xls work book. I do not currently have permissions to create a procedure…..is using a cursor an option? If so, how?I know this may be to little information but any help would be greatly appreciated. Thank you |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-11 : 11:33:28
|
You just need to create a single report on reporting services with country as parameter. then use first query to populate parameter values by creating a dataset and use second query to generate report data. |
 |
|
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2008-03-11 : 11:34:55
|
I only have access to Query Analyzer..... |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-11 : 11:38:01
|
Then create a stored procedure in QA and copy and apste the results onto an excel sheet. |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2008-03-11 : 11:39:57
|
Please tell me you are not trying to write a report with Query Analyzer! That is not what it is designed to do, it is not a reporting tool -- it is a "query analyzer" tool. You need to use a proper tool that can prompt for parameters, output formatting, do grouping and totaling, and so on. Tools that can do this include Reporting services, Crystal Report, MS Access, and even Excel to some extent.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2008-03-11 : 11:51:00
|
The "reports" I mentioned are more like data extracts. My life would be alot easier if I had some of the tools you mentioned at my disposal...unfortunaltely I don't. Thank you for the help |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-11 : 11:54:48
|
Are you able to create SP? |
 |
|
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2008-03-11 : 11:57:28
|
I've requested that I be added to the appropriate role. Yes, by days end, I will be permittedI'm not sure how to pass the reults to the second query though one record at a timeI appreciate your time / help |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-11 : 12:03:49
|
CREATE PROC GetReportDataASSELECT blah blah FROM blah blah WHERE Country IN(SELECT Country FROM Countries)GO this gives detail for all countries.Get this onto excel sheet (remember to select the option include column headers while copying/selecting)Then add autofileter for headers.Filter for each country and take filtered list out to seperte sheets and send them to your users.else,put a parameter and manualy run in each time for each country.CREATE PROC GetReportData@Country varchar(50)ASSELECT blah blah FROM blah blah WHERE Country =@CountryGO |
 |
|
callawayx14
Yak Posting Veteran
73 Posts |
Posted - 2008-03-11 : 13:44:46
|
visakh16..........Thank you very much for your. I really appreciate your help....Thanks again!!! |
 |
|
|