http://vinay-thakur.spaces.live.com/blog/cns!645E3FC14D5130F2!591.entry
and if we want to export into xls we can use the below query but we have to give heading Name onexcelTargetfile.xls file before running this query:
INSERT INTO
OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=e:\excelTargetfile.xls;Extended Properties=Excel 8.0;')...[Sheet1$]
SELECT name FROM master.dbo.sysdatabases
GO
we can use the same with OPENROWSET
http://www.mssqltips.com/tip.asp?tip=1202
HTH
Vinay
Thanx.
Vinay
http://rdbmsexperts.com/Blogs/
http://vinay-thakur.spaces.live.com/
http://twitter.com/ThakurVinay