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 2012 Forums
 SSIS and Import/Export (2012)
 Export SQL table to excel

Author  Topic 

morikoth
Starting Member

5 Posts

Posted - 2013-08-13 : 08:07:11
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

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-08-13 : 09:50:36
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

5 Posts

Posted - 2013-08-13 : 10:10:31
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
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-08-13 : 13:18:08
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

5 Posts

Posted - 2013-08-14 : 03:48:08
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
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-08-20 : 08:16:02
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

22864 Posts

Posted - 2013-08-20 : 09:26:34
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
   

- Advertisement -