Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS Export To Excel

Status
Not open for further replies.

sandylou

Programmer
Jan 18, 2002
147
US
I am familiar with VBScript and can successfully export data in VB to an Excel file. I am now playing around with DTS packages and am a newbie. I have a stored procedure which contains the data I want. No parameters are passed into this sproc. I want to take the results of the sproc and export it into excel. I would like to set up my excel file dynamically as I have done in VB. I am trying to accomplish this by using Active X Scripting. I am not sure how I go from the Execute of my stored procedure to passing the result set similar to my SQL recordset:
Code:
.Range((.Cells(varCurRow, 1)), (.Cells(varCurRow, 1))).CopyFromRecordset rstDetail
I have seen some code that talks about the data pump and accessing the parent property. Is this what I need to do?
 
What is your source data coming from??? Access, SQL Server, Oracle ....

Thanks

J. Kusch
 
I import data in from a few sources. They are large tables. I use a stored procedure to create a complex query which makes temporary tables and then drops then. It is from the results of my stored procedure in which I would like to export the results.
 
I will assume the query is being executed against a SQL Server database.

In the DTS designer, create a source connection being your SQL Server and needed database.

Create a destination connection being your Excel worksheet.

Create a "Transform Data Task" task that links your source connection, the SQL Server database, to you destination connection being your worksheet.

Double click on the task and in the Source tab, select "SQL query" then paste your query in.

After that, go to each of the other tabs and set the needed parameters and settings.

Click the green arrow at the top of the designer when you are ready to execute it.

That is the "short" of it. Hope this helps!



Thanks

J. Kusch
 
When you create an Excel Connection, you need to identify the file name you want. I want to dynamically create this. This is why I thought I could create it in Active X, similar to how I would export queries in Access. I am using Transform Data Task, however, I am executing a stored procedure. I am only given one tab to use.
 
I am attempting to export data from a SQL Serve table to excel. It work fine as long as the excel spreadsheet always exists. Is there a way that once the package is execute to create the excel spreadsheet on the fly and not at the time the package is created?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top