Link to home
Start Free TrialLog in
Avatar of upobDaPlaya
upobDaPlaya

asked on

Exporting from SQL Server to Excel

Is it possible to export from SQL Server into a new Excel workbook and load the data into mult tabs.

From SQL Server
tbl1
tbl2
tbl3

Into Excel (1 workbook, multiple tabs)
tab1
tab2
tab3
Avatar of jogos
jogos
Flag of Belgium image

With openrowset you can choose your sheet, but that must be prepared to have all columns of right type already.
insert into OPENROWSET(
        'Microsoft.Jet.OLEDB.4.0', 
        'Excel 8.0;Database=d:\export\prebaredFile.xls;;HDR=YES', 
        'SELECT * FROM [Sheet1$]')
select * from yourtab1

Open in new window

More examples at
http://www.ashishblog.com/importexport-excel-xlsx-or-xls-file-into-sql-server/

There is the ability to import in your excel
http://sqlwithmanoj.com/2009/09/24/create-an-excel-refreshable-report-from-database-pivot-report/
SOLUTION
Avatar of prequel_server
prequel_server

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of upobDaPlaya
upobDaPlaya

ASKER

Whats involved using SSIS..would I need to load any special files on my computer ?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note sure what route I will head..Will first do some more research based on the information provided above..
I would say SSIS is your best bet. You can make create multiple data flows all going to different sheets in one Excel workbook.  Post another question asking that specifically so we can help.

Cheers