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 2000 Forums
 Transact-SQL (2000)
 Trouble Updating Excel File From Table!

Author  Topic 

SMBDeveloper
Starting Member

2 Posts

Posted - 2007-09-10 : 21:50:08
There is a table in my database projected_daily_tbl and a corresponding Excel file on the server. I want to run SQL code that updates a field in the Excel file from the SQL table, and then updates another field in the SQL table from the Excel file.

I'm able to update the table based on the Excel file:

update projected_daily_tbl set percent_dispensed=exceltable.percent_dispensed from
(select * from OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Inetpub\wwwroot\bvig\input\projected_daily_tbl.xls',
'SELECT * FROM [Sheet1$]')) exceltable
where exceltable.id=projected_daily_tbl.id


However, when trying to do the reverse (updating the atmamount field in the Excel sheet based on the table), I have major problem designing a syntactically correct query. I want to do this as a single update query (no cursor!). Please tell me what I can do!

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-09-11 : 08:12:53
why not just overwrite it? if you're going to do excel manipulation, do it in a programming language other than sql

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -