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.
Author |
Topic |
durgapras
Starting Member
15 Posts |
Posted - 2008-02-23 : 23:42:33
|
Hi,I am currently running the following query to export Data from a table to a ExcelSheet(test.xls)INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\test.xls;', 'SELECT * FROM [Sheet1$]') select * from SYSCUST_AUDITEverything is working fine.NP's so far.The thing what I am really looking for is,Is there a way where I can write a query and it should dynamically create a Excel sheet and export the data from the table.Now I have manually created test.xls.What I am looking for is ,Write some query which dynamically creates test_'Date'.xls and export the data from the table.So after 5 days,My c:folder should have following filestest_'date1'.xls test_'date2'.xlstest_'date3'.xlstest_'date4'.xlstest_'date5'.xlsThanks in advance |
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2008-02-24 : 00:38:34
|
There are ways using VB Script that can do it....not sure if it can be done using the openrowset method...There are tons of ways to dynamically create, name and manipulate excel using the excel object in VB or C# scripting. It would be easier still to have Excel do all the work using MS Query and VBA within the excel file--excel can even be set up to open automatically, run the code, and close. Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
|
|