Solved

DTS Export to excel, template file not present

Posted on 2004-08-16
7
377 Views
Last Modified: 2013-11-30
I have several DTS packages that export to Excel, you know how you need to create the destination table in the Transform Data Task Properties before you can do an export? I would like to have the DTS package create the destination table and file if a template does not already exist.
How do I go about doing that?
Any sample code?
0
Comment
Question by:Tacobell777
7 Comments
 
LVL 34

Assisted Solution

by:arbert
arbert earned 250 total points
ID: 11817508
It's not that easy--does your format stay the same from file to file?  The easiest method we've really found is to create a "template" xls file that just has headings (or whatever is needed, database range, etc).  Then, when the DTS package starts, it copies the blank "template" xls file to the "working" xls file for the output.
0
 
LVL 17

Author Comment

by:Tacobell777
ID: 11817634
yeah thats what I am doing at the moment, but that doesn't suit me all the time. Like for example when the DTS is moved to Production I'd like it to create the template if it doesn't exist.

There must be some other way of doing it? This is a pain in the butt..
0
 
LVL 34

Assisted Solution

by:arbert
arbert earned 250 total points
ID: 11817708
Couple of other options we've used--use an Execute SQL task with a create table statement against the excel connection--I've had mixed results with this.  If you have Excel installed on the server (most shops don't and wouldn't) you could use the Excel Object Model to create the structure you need on the fly.

End the end, we opted for the "copy the template" method.  Without using the Excel Object Model, this seemed to be the easiest way to get the sheect exaclty like we needed it. :(
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 10

Accepted Solution

by:
Jay Toops earned 250 total points
ID: 11821594
How about this.

store the template as an blob object in the database.

Jay
0
 
LVL 9

Expert Comment

by:SoftEng007
ID: 11822955
I also have had mixed results using Execute SQL task with a create table statement against the excel connection.

We also opted for a template copy model.
much more reliable and you can get some realy good looking data exports using a prefab template.
0
 
LVL 17

Author Comment

by:Tacobell777
ID: 11825979
jltoops, I like your idea - its probably not one of the quickest solutions, but at least the template is stored with the database.

I guess you could implement some ActiveX task to see if the template exists, if so, then copy it, if not then retrieve it from the db and copy it.

Still: is there no way to look at the Transformations - destination columns and create a template dynamically based on that information?
0
 
LVL 34

Expert Comment

by:arbert
ID: 11826585
Just with the executesql task (unless you have excel loaded on the server)....
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question