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 |
|
mayurcreation
Starting Member
16 Posts |
Posted - 2007-09-12 : 10:14:06
|
| HiI need to export table into excel file each time I run store procedure.When I run store procedure it should delete all old records from excel file and than insert new records into excelinsert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Projects\PAYOUTS\FILES\MayurTestOutPut.xls;','SELECT bwnum, description, manager_id, salesperson_id, salesperson_name, salesperson_perc_of_account, salesperson_payout_deal FROM [Sheet1$]') select bwnum, description, manager_id, salesperson_id, salesperson_name, salesperson_perc_of_account, salesperson_payout_deal from view_payoutsvalue How to delete old rows from excel file ??Please help - It is urgent for me... |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2007-09-12 : 10:16:09
|
| Why not overwrite the excel file?or populate an excel template? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-09-12 : 10:39:47
|
| http://sqlteam.com/forums/topic.asp?TOPIC_ID=87225&whichpage=2#332121MadhivananFailing to plan is Planning to fail |
 |
|
|
mayurcreation
Starting Member
16 Posts |
Posted - 2007-09-12 : 10:46:30
|
Overwrite will not work because numbers of rows are not sure and data too...Thanks!!quote: Originally posted by ValterBorges Why not overwrite the excel file?or populate an excel template?
|
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2007-09-12 : 10:54:20
|
| sure it will...import the xls then delete or modify what you need to do then export and overwrite--------------------keeping it simple... |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2007-09-12 : 18:49:22
|
| Yes it will I do it all the time.Create a template and in the first step of your dts copy the template to a new filename ex: ExcelTemplate.xls --> MyReport.xlsIn the second step use a data transform to pull data from query into myreport.xlsIn the third step rename MyReport.xls to MyReport4Q.xlsPS: If anyone is interested in a SQL Job in CT with excellent pay send me a resume to ValterBorges@msn.com |
 |
|
|
mayurcreation
Starting Member
16 Posts |
Posted - 2007-09-13 : 10:07:21
|
| Thanks for your help. |
 |
|
|
|
|
|
|
|