dbTalk Databases Forums  

Exporting Records to Excel (Records appending !!!)

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


Discuss Exporting Records to Excel (Records appending !!!) in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ray via SQLMonster.com
 
Posts: n/a

Default Exporting Records to Excel (Records appending !!!) - 04-26-2005 , 09:50 AM






Hi,

I am trying to export some records everyday to a destination (.xls) file
through SQL Server Enterprize Manager. The DTS package works fine .... BUT
the problem is every time the DTS package runs the records get appended in
the .xls file.

HOW CAN I MAKE SURE THAT THE .XLS FILE IS OVERWRITTEN EVERDAY .... SOMEONE
PLEEEEASE HELP ME.....

Regards.

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

Default Re: Exporting Records to Excel (Records appending !!!) - 04-26-2005 , 12:38 PM






So here is what works for me using Excel 2003

I have an ExecuteSQL task which does a DROP TABLE against the XL connection
I have an ExecuteSQL task which does a CREATE TABLE against the XL connection
I then have the Transform Data task that puts data into the file

Help any?

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Ray via SQLMonster.com" <forum (AT) nospam (DOT) SQLMonster.com> wrote

Quote:
Hi,

I am trying to export some records everyday to a destination (.xls) file
through SQL Server Enterprize Manager. The DTS package works fine .... BUT
the problem is every time the DTS package runs the records get appended in
the .xls file.

HOW CAN I MAKE SURE THAT THE .XLS FILE IS OVERWRITTEN EVERDAY .... SOMEONE
PLEEEEASE HELP ME.....

Regards.



Reply With Quote
  #3  
Old   
Ray via SQLMonster.com
 
Posts: n/a

Default Re: Exporting Records to Excel (Records appending !!!) - 04-26-2005 , 03:42 PM



Thanks a lot,Allan Mitchell.

I was succesfull in DROPPING TABLE against the XL connection
by using the code:
exec master..xp_cmdshell "del j:\my_delete.txt"

BUT
I was unable to CREATE TABLE against the XL connection.

Can u please help me with the code for creating table against the XL
connection.

Best regards.

--
Message posted via http://www.sqlmonster.com

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

Default Re: Exporting Records to Excel (Records appending !!!) - 04-26-2005 , 03:57 PM



Drop onto designer an ExecuteSQL task
In there put

DROP TABLE 'MyExcelTableNameGoesHere'

You can then issue a CREATE TABLE statement as well in a seperate ExecuteSQL task





--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Ray via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
Thanks a lot,Allan Mitchell.

I was succesfull in DROPPING TABLE against the XL connection
by using the code:
exec master..xp_cmdshell "del j:\my_delete.txt"

BUT
I was unable to CREATE TABLE against the XL connection.

Can u please help me with the code for creating table against the XL
connection.

Best regards.

--
Message posted via http://www.sqlmonster.com



Reply With Quote
  #5  
Old   
Ray via SQLMonster.com
 
Posts: n/a

Default Re: Exporting Records to Excel (Records appending !!!) - 04-26-2005 , 04:41 PM



DROP TABLE 'MyExcelTableNameGoesHere'

would not work for me ... But the following worked for me:

exec master..xp_cmdshell "del j:\MyExcelTableNameGoesHere"

Now I need help with the codes for:

CREATEING TABLE against the XL connection

Best regards.

--
Message posted via http://www.sqlmonster.com

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

Default Re: Exporting Records to Excel (Records appending !!!) - 04-26-2005 , 04:47 PM



You are talking about deleting the whole Spreadsheet. I am talking about deleting a worksheet/Name Range/Table within a spreadsheet

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


"Ray via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
DROP TABLE 'MyExcelTableNameGoesHere'

would not work for me ... But the following worked for me:

exec master..xp_cmdshell "del j:\MyExcelTableNameGoesHere"

Now I need help with the codes for:

CREATEING TABLE against the XL connection

Best regards.

--
Message posted via http://www.sqlmonster.com



Reply With Quote
  #7  
Old   
Ray via SQLMonster.com
 
Posts: n/a

Default Re: Exporting Records to Excel (Records appending !!!) - 04-27-2005 , 07:59 AM



Yes, u got it ... I am talking about deleting the whole Spreadsheet.

Is it possible to create a fresh spreadsheet against the XL connection in
the DTS package.

Thanks for your help!

Regards.

--
Message posted via http://www.sqlmonster.com

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.