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)
 Exporting single value to excel

Author  Topic 

vsjayashri
Starting Member

4 Posts

Posted - 2008-10-21 : 05:43:06
Hi

declare @dFrom varchar(12)

set @dFrom = convert(varchar,getdate(),112)

INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D:\test.xls','SELECT * FROM October$B2:B2]')
@dFrom

I want to write the date on the october sheet in b2 cell,
I tried the above method but failed to do,
Please help .

Jayasri

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-21 : 05:48:24
INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D:\test.xls','SELECT * FROM October$B2:B2]')
SELECT @dFrom

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

vsjayashri
Starting Member

4 Posts

Posted - 2008-10-21 : 06:11:58
Thanks, it is working now.
Go to Top of Page
   

- Advertisement -