May 1, 2007 at 5:22 pm
Hi,
I have some data which I break down by categories and export into an Excel file. Each category goes into separate worksheet. Users may create some more categories from time to time. I need to create some routines which will take into account those new categories. Currently I just manually add another "Transform data task" for each new category in my DTS package. Is there a more dynamic and way of doing this?
Thanks.
May 2, 2007 at 9:14 am
There isn't an easy way I can think of. You could use an Active X task in a parent package to modify the current package and add tasks, but I think adding a transform is the simplest way to do this.
May 2, 2007 at 11:00 am
Try the other way. Create an excel Macro that connects to your SQL DB, loop thru all the categories and while in each category build a SELECT statement on the fly that plugs the data into a new Sheet.
That's just a hint, the actual code will be priceless!!!!. If you need a hint on the VBA code reply.
May 2, 2007 at 5:41 pm
I will think about this way, but I am afraid this will be very slow as the record set is very large. Worth trying anyway.
I was also considering building a script for the DTS package dynamically in VB file format, but unfortunately putting it back into SQL server is a manual process. You can't just run the script.
May 2, 2007 at 5:44 pm
This could be a solution, but I am not good in Active X area. Do you know about any examples of similar code on the web?
May 3, 2007 at 7:16 pm
I guess I'll never understand why folks try to push data into Excel when the "Get External Data" feature in Excel works so very well...
--Jeff Moden
Change is inevitable... Change for the better is not.
May 4, 2007 at 1:46 am
Ditto
Although I use a Auto_Open macro to execute proc and insert data by ordinal columns into one or more sheets formatted according to sql datatype
Far away is close at hand in the images of elsewhere.
Anon.
May 4, 2007 at 5:18 pm
Concur... and, if you do it right, don't even need that... the "External Data Ranges" can be setup to "auto-magically" refresh on open. In Excel 2k3 and above, you can even make the external data ranges refresh on a timed basis AND have it "auto-magically" copy adjacent formulas down as the range grows or shrinks. PFM!!!
--Jeff Moden
Change is inevitable... Change for the better is not.
May 7, 2007 at 1:51 am
The dataset is too large to allow everyone query the database to populate their own file. So there has to be just one file to be copied from by all the people. I could possibly populate it and then put into a shared folder, but this is a manual process.
May 7, 2007 at 1:53 am
The same as above, I can't allow every user to do this and the report should run at a particular time overnight, as it is heavy. I prefer to sleep at this time.
May 7, 2007 at 6:57 am
Then you can write a stored procedure that figures all that out (provided CATEGORY is used in a normalized fashion) and DTS the results of the stored procedure or put them in a tab delimited file, or whatever. But you've basically told us that your car needs some repairs and haven't even shown us the car yet.
Some example data in the form of INSERT/SELECTs, some table CREATEs to match, a little more info about exactly what you want to do and you'll be surprised Folks just might be able to help a little more...
--Jeff Moden
Change is inevitable... Change for the better is not.
May 7, 2007 at 8:43 am
I can't allow every user to do this and the report should run at a particular time overnight, as it is heavy |
Create a workbook with no sheets, insert a module and in Auto_Open sub
create a new workbook
retrieve the data
insert it in worksheet in the created workbook
save and close the created workbook
close original workbook
close excel
Schedule Excel to run at designated time and use the workbook as parameter
Far away is close at hand in the images of elsewhere.
Anon.
May 7, 2007 at 6:09 pm
Hi,
This is my query:
Select ContractId ,
Balance,
Charge_Receivables ,
Residual ,
Interest ,
Asset ,
Income,
Charges
From ContractAccount
Where Accountid in (select disticnt Accountid from ContractAccount (nolock))
Accountid defines categories. I want all data, related to the same category to be exported into separate worksheet. I would be good to be able to create another Excel file if the number of categories exceeds the max number of worksheets (255) within the same Excel file.
Thanks.
May 7, 2007 at 8:48 pm
Just one more question... why spreadsheets... why not print reports?
--Jeff Moden
Change is inevitable... Change for the better is not.
May 8, 2007 at 1:17 am
I was asking a similar question: why Excel... why not Analysis Services? It looks like this is the form users are used to use and they want nothing else...
Viewing 15 posts - 1 through 15 (of 20 total)
You must be logged in to reply to this topic. Login to reply