Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Export Database(SQL server 2005) to Excel

Author  Topic 

billdng
Starting Member

17 Posts

Posted - 2009-04-16 : 22:12:18
dear all,
I run the following sentence :
-- Export data to existing EXCEL file from SQL Server table
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\testing.xls;',
'SELECT * FROM [SheetName$]') select * from SQLServerTable

my question is:
1.how can I make the name of the excel a Variable ? such as 20090417.xls,20090418.xls,20090419.xls....
2.when the data export to excel ,how can i delete the excel' exist data ? certainly , the data were deleted not contain the first line.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-17 : 11:28:47
1.you need to use dynamic sql for that
2.you need to use UPDATE and set all cells to blank for that
Go to Top of Page

billdng
Starting Member

17 Posts

Posted - 2009-04-19 : 21:37:48
quote:
Originally posted by visakh16

1.you need to use dynamic sql for that
2.you need to use UPDATE and set all cells to blank for that



dear sir,
Can you make me any code example ? I even dont know how to do that .Thanks in advance .
Go to Top of Page
   

- Advertisement -