473,383 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Exporting data to Excel from a DTS

Hi all,

I've seen this noted in many posts, but nothing I've checked out gives
me any clue on how to do this.

Basically as my topic says, I have a DTS and I simply need to export
some data from a table in MS SQL 2000 to an Excel spreadsheet. I also
need to automate this process so it can run nightly and each new day a
new spreadsheet will be on a network share for us to pick-up.

Can someone point me to the right direction? This needs to be done
totally through the DTS script, so no ImportExport wizard or anything
manual.

Thanks --

Sam

Jul 23 '05 #1
1 10461
Alex wrote:
Hi all,

I've seen this noted in many posts, but nothing I've checked out gives
me any clue on how to do this.

Basically as my topic says, I have a DTS and I simply need to export
some data from a table in MS SQL 2000 to an Excel spreadsheet. I also
need to automate this process so it can run nightly and each new day a
new spreadsheet will be on a network share for us to pick-up.

Can someone point me to the right direction? This needs to be done
totally through the DTS script, so no ImportExport wizard or anything
manual.

Thanks --

Sam


I have dozens of DTS packages that create Excel reports. Here is the method I use:

1. FTP a template workbook from source folder to reports folder.
2. Create worksheet (table) in the report workbook
3. Data pump from SQL Server to the workbook.
4. E-mail the report to recipients

Here's the setup details:
1. Create a source folder on the server. This keeps all my report templates.
2. In the source folder, create a template workbook with just one worksheet.
In my company, this sheet has the company name, the name of the report and
standard boiler-plate text about confidentiality, etc. This is the primary
reason I use this approach, since it does not require that I re-create the
standard title worksheet every time.
3. Copy the template workbook from source folder to reports folder. You need
to do this only for the first time. The file must exist in order to create the
connection. SQLAgentCmdExec will need write access to the reports folder.
4. Create DTS package:
5. Create two connections, one to SQL Server, the other to the workbook in the
reports folder.
6. Task 1 - FTP task to copy template from source to reports, with overwrite
7. Task 2 - Execute SQL Task to CREATE TABLE (worksheet) in the report. I
create the table every time the package runs rather than keeping it in the
template because the report may change over time. When this happens, I just
change the data pump and leave the template alone.
8. Task 3 - Data Transformation task to pump data into the worksheet. The
source would be your SQL statement that selects the data from your five tables.
9. Task 4 - ActiveX task to e-mail the report.

The easiest way to create the CREATE TABLE statement is to set up the data pump
task and click on the Create Table button. Copy the Create `New Table`....
statement to the clipboard and paste it into the Execute SQL task, changing the
table name as appropriate. The table name becomes the worksheet name. If you
edit this satement, be careful not to use single-quote character. The delimiter
in the statement is the left-leaning accent mark (the one at upper-left of
keyboard, on same key as tilde).

HTH,

Ed
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
2
by: deko | last post by:
I use a complied query to export to Excel like this: SELECT * INTO . FROM tblExcelData; But I have a situation where I need to export several tables into the same worksheet. The idea is to...
2
by: Mike P | last post by:
How do you go about exporting data in excel to a C# dataset? Any help would be really appreciated. Cheers, Mike
1
by: ad | last post by:
I use the code below to export the content of a data set to Excel, the code come form http://www.dotnetjohn.com/articles.aspx?articleid=36 But it always use the web form's name as the default...
2
by: pmud | last post by:
Hi, I am exporting data from an EDITABLE DATA GRID EXCEL. But the 1st column in data grid is Edit Column. I want to display all columns in Excel except for the Edit column. The following...
1
by: Mustufa Baig | last post by:
I have an ASP.NET website where I am showing off crystal reports to users by exporting them to pdf format. Following is the code: ---------------- 1 Private Sub ExportReport() 2 Dim oStream...
6
by: Opa | last post by:
Hi, I have a DataGrid, whose sourceI am exporting to Excel. This works fine except for the Column ordering. My datasource is not a datatable, with a typical SELECT statement where I can...
1
by: Jason.A.Oliver | last post by:
Hi everyone, Quick question. I'm very much a beginner with Access so I'm sorry if there's an easy way that I missed. I have several fairly large tables that I am trying to export from Access...
4
by: Tom | last post by:
I have a gridview on all of my web pages in my web app and they all export to excel. I have one page where the gridview is binding to a datatable that i created and only the first column is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.