SISS Using Problem in EXCEL
Hi Everyone.
I'm a new one of using SSIS for my program in c#.
I have one problem of database to excel
if i want to modified the column name in first row of excel in parameter.
for example:
database table save as a1,a2,a3 column
send to excel save as 99a1,99a2,99a3
the prefix is send form the c# program.
I know how to get the parameter between program and package.
but how could i set these to the excel column ?HenrySource
May 1st, 2011 3:50pm
Are you issueing a "CREATE TABLE" statement to the Excel connection manager via an Execute SQL Task? If so, you could design the SQL Statement in there to give the columne the propert field names.Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
May 1st, 2011 4:07pm
when you say parameter what do you exactly mean parameter? the prefix as a parameter passed between program and package?
if there is a variable in SSIS package, you can update it at run time.If you think my suggestion is useful, please rate it as helpful.
If it has helped you to resolve the problem, please Mark it as Answer.
http://twitter.com/7Kn1ghts
May 1st, 2011 4:30pm
Yes,the parameter is passed between program and package.HenrySource
Free Windows Admin Tool Kit Click here and download it now
May 1st, 2011 4:35pm
Would you be able to modify your c programme? if so, that's easy.
If not, you need find out how does your c program pass param to package? via command line, e.g. call dtexec?If you think my suggestion is useful, please rate it as helpful.
If it has helped you to resolve the problem, please Mark it as Answer.
http://twitter.com/7Kn1ghts
May 1st, 2011 4:57pm
yes,i can modify my program.
i know how to send variable to ssis package.
but i don't know how to add this to the excel column. HenrySource
Free Windows Admin Tool Kit Click here and download it now
May 3rd, 2011 6:42am
For this once again you have to use c# script to update the excel cells.
This logic you can write in your program itself as the prefix is generated from the c# code.
A sample code can be found here
http://www.codeproject.com/KB/cs/WriteDataToExcel.aspx
May 3rd, 2011 7:50am
Have a read of http://msdn.microsoft.com/en-us/library/cc280502.aspx
also http://weblogs.asp.net/rrobbins/archive/2009/01/15/ssis-package-user-variables.aspx
do you know how many columns are you going to deal with? or you dont know yet? is it fixed?
Probably you can use your c program to get all columns names first, then set the header part of select sql statement as a variable like
select ? from table.xx where xxxxx
and when you pass the var into the SSIS, you can set your var as a string, something like
colA as pre~colA, colB as xx~colB
Or you can have a list of column names, and play with it inside the SSISIf you think my suggestion is useful, please rate it as helpful.
If it has helped you to resolve the problem, please Mark it as Answer.
http://twitter.com/7Kn1ghts
Free Windows Admin Tool Kit Click here and download it now
May 3rd, 2011 2:14pm