Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 Export SQL table to excel
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

morikoth
Starting Member

Romania
5 Posts

Posted - 08/13/2013 :  08:07:11  Show Profile  Reply with Quote
Hello,

I am trying to export a table from SQL to excel dynamically so if i add a new column to the table it will automatic export to excel.
I was trying to do it from script file but i had meet a lot of problems.
Can anyone help me please?

P.S. i don't want to use openrowset or bcp

Best regards,
Marius

Edited by - morikoth on 08/13/2013 08:25:13

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 08/13/2013 :  09:50:36  Show Profile  Reply with Quote
quote:
Originally posted by morikoth

Hello,

I am trying to export a table from SQL to excel dynamically so if i add a new column to the table it will automatic export to excel.
I was trying to do it from script file but i had meet a lot of problems.
Can anyone help me please?

P.S. i don't want to use openrowset or bcp

Best regards,
Marius


What is the method you are using currently, even if it is for a static table?
Go to Top of Page

morikoth
Starting Member

Romania
5 Posts

Posted - 08/13/2013 :  10:10:31  Show Profile  Reply with Quote
quote:
What is the method you are using currently, even if it is for a static table?


Normally SSIS have a simple way to export sql data to excel but you need to map table column with excel column so when i add a new column to my sql table i need to go in my SSIS package and add the new mapping to. So i need a way to do it without this mapping.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 08/13/2013 :  13:18:08  Show Profile  Reply with Quote
Openquery or bcp with dynamic sql would be more suited in this case. You can do this using SSIS, but you will need to have a script task that can parse the meta data of the table and do the mappings. That is not an easy task unless you have a good level of expertise in SSIS. If you don't have that expertise, and easier route might be to google for examples and try to mimick it. http://wikiprogrammer.wordpress.com/2011/04/08/dynamic-column-mapping-in-ssis-part-1/
Go to Top of Page

morikoth
Starting Member

Romania
5 Posts

Posted - 08/14/2013 :  03:48:08  Show Profile  Reply with Quote
quote:
Originally posted by James K

Openquery or bcp with dynamic sql would be more suited in this case. You can do this using SSIS, but you will need to have a script task that can parse the meta data of the table and do the mappings. That is not an easy task unless you have a good level of expertise in SSIS. If you don't have that expertise, and easier route might be to google for examples and try to mimick it. http://wikiprogrammer.wordpress.com/2011/04/08/dynamic-column-mapping-in-ssis-part-1/


i know that will far easier with openquery or bcp but i need to do it using SSIS. Thx for the link but it dosent help me to much...what i don't understand is why i can't just do an easy dataset export to excel in script task part...i guess i need to create source and destination objects dynamic with script task which is far beyond my SSIS level since i have few days of it...i tried to find some examples but i didn't have any luck
Go to Top of Page

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2179 Posts

Posted - 08/20/2013 :  08:16:02  Show Profile  Visit jackv's Homepage  Reply with Quote
You can use Powershell to export to Excel from SQL Server - use this script and adapt to your needs - http://www.sqlserver-dba.com/2013/05/sql-server-export-to-excel-with-powershell.html

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22864 Posts

Posted - 08/20/2013 :  09:26:34  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Also try http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000