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
 Transact-SQL (2005)
 update opendatasource

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2008-02-04 : 11:58:10
An excel file has columns such as :

Security_ID, Security_Name, Bid_Price, Ask_Price
If possible please let me know how to correct this query to update the spreadsheet from sql server 2005 data.

Thanks


UPDATE OPENDATASOURCE ('Microsoft.Jet.OleDB.4.0',
'Data Source=C:\Work\Data.xls; extended Properties=Excel 8.0')...AllBonds$
set Bid_Price =
Ask_Price =

The result is coming from this sql:
select
sec.Security_ID--,
sec.Security_Name,
p.Bid_Price,
p.Ask_Price
from
tblPrices p right join tblSecurities sec on sec.Security_ID = p.Security_ID
where
convert(varchar(11), Price_Quote_Date) = dateadd(d, -4, convert(varchar(11), getdate()))

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-02-04 : 14:13:31
If all that's wrong is the SQL Query, it may just be a typo.

sec.Security_ID--,

is commenting out the ","

Hope that helps

Jim
Go to Top of Page
   

- Advertisement -