dbTalk Databases Forums  

Create Excel File via VB.NET / DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Create Excel File via VB.NET / DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alex
 
Posts: n/a

Default Create Excel File via VB.NET / DTS - 12-18-2003 , 12:16 PM






Hi folks,

I'm pretty new in DTS (actually it's my first DTS project at all) and
thank you guys for every hint/help in advance.
I'm using VB.NET and MS SQL Server 2000
I need to do the following:
- Read data from SQL-Server and convert it to an excel file
- the SQL-Source-statement is different, every time (number/name of
columns, view/table ...)!
And that's my problem.
I know that there's the possibility to work with global variables,
dynamic properties, active x scripts, custom tasks etc.
But in the end I don't know which technique could solve my problem
best...and where to start, too.
At this point I figured out four steps to solve my problem:
1. Delete Excel worksheet (SQL Ta
2. Fill worksheet with columns
3. Read data from view
4. Fill this data in Excel worksheet
and again, the number/names of columns and the view change everytime!

thanks for your help

best regards

alex

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Create Excel File via VB.NET / DTS - 12-19-2003 , 02:02 AM






Couple of ways

1. Use a linked server to the Excel spreadsheet and a SELECT INTO statement
2. Recreate the datapump each time. *

* You will need to
1. Read the source statement
2. Create a table in Excel to mimic the source
3. Drop all previous transformations
4. Create the new ones
5. Set the destinationObjectName to the new name of the table


#1 is definitely easier.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Alex" <alexander_simons (AT) web (DOT) de> wrote

Quote:
Hi folks,

I'm pretty new in DTS (actually it's my first DTS project at all) and
thank you guys for every hint/help in advance.
I'm using VB.NET and MS SQL Server 2000
I need to do the following:
- Read data from SQL-Server and convert it to an excel file
- the SQL-Source-statement is different, every time (number/name of
columns, view/table ...)!
And that's my problem.
I know that there's the possibility to work with global variables,
dynamic properties, active x scripts, custom tasks etc.
But in the end I don't know which technique could solve my problem
best...and where to start, too.
At this point I figured out four steps to solve my problem:
1. Delete Excel worksheet (SQL Ta
2. Fill worksheet with columns
3. Read data from view
4. Fill this data in Excel worksheet
and again, the number/names of columns and the view change everytime!

thanks for your help

best regards

alex



Reply With Quote
  #3  
Old   
Alex
 
Posts: n/a

Default Re: Create Excel File via VB.NET / DTS - 12-21-2003 , 07:28 AM



Quote:
1. Use a linked server to the Excel spreadsheet and a SELECT INTO statement
could you give me some more details, please?

regards alex


Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Create Excel File via VB.NET / DTS - 12-22-2003 , 01:38 AM



Yep

To add a linked server (Excel)

EXEC sp_addlinkedserver 'ExcelSource',
'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'c:\MyData\DistExcl.xls',
NULL,
'Excel 5.0'
GO


Then to use it do

SELECT * INTO TableMine FROM OPENQUERY(ExcelSource,'SELECT * FROM
[Sheet1$]')


--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Alex" <alexander_simons (AT) web (DOT) de> wrote

Quote:
1. Use a linked server to the Excel spreadsheet and a SELECT INTO
statement
could you give me some more details, please?

regards alex



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.