Solved

DTS Export to excel, template file not present

Posted on 2004-08-16
7
374 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

864 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now