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 |
|
PeterNeo
Constraint Violating Yak Guru
357 Posts |
Posted - 2008-10-27 : 03:16:51
|
| [code]Hi All,I want to Export my results to different Excel Sheets.i.e : If I have two Select statements like the belowSELECT * FROM AdventureWorks.HumanResources.DepartmentSELECT * FROM AdventureWorks.HumanResources.Employeethe results of both queries should be exported to single Excel file with two different Sheets, one for Department another for Employee.Currently i am using OPENROWSET to export the dataINSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\test.xls;','SELECT * FROM [Sheet1$]') SELECT * FROM AdventureWorks.HumanResources.DepartmentThanks in advance[/code][code]"There is only one difference between a dream and an aim. A dream requires soundless sleep to see, whereas an aim requires sleepless efforts to achieve..!!"[/code] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-27 : 04:04:32
|
| did you try specify two inserts using OPENROWSET with just only sheet names varying? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-29 : 06:53:16
|
| INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\test.xls;','SELECT * FROM [Sheet1$]') SELECT * FROM AdventureWorks.HumanResources.DepartmentINSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\test.xls;','SELECT * FROM [Sheet2$]') SELECT * FROM AdventureWorks.HumanResources.EmployeeMore informations are herehttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|