Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Variable no of Excel columns Expand / Collapse
Author
Message
Posted Tuesday, September 16, 2008 10:14 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, November 21, 2008 8:02 AM
Points: 10, Visits: 42
I have a spreadsheet that allows the users to enter additional column values. Meaning some users will have 16 columns and others may have 17 , 18 up to max of 20.

Is there a way to build this map. I created a map with 20, then when a spreadsheet was read that only had 16 I received a error saying could not find columns 17,18,19,20

Any help is appreciated.
Richard
Post #570418
Posted Tuesday, September 16, 2008 1:08 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, August 10, 2010 5:07 AM
Points: 2,732, Visits: 23,078
SSIS does not like changing schema.

You could stabilize the schema by using a second workbook that consists of a bunch of formulas that link it to the actual data you want to import. This would allow you to create some formulas that made sure empty columns were available even if users did not enter data. This is a pretty ugly solution though.

Another option would be to use a script task in your data flow as a source. You could then use a bit of VB to extract the data from the workbook and add it to the output buffer. Again, this would allow you to just put NULL into the empty fields.

Finally, if you wanted to expand on the last option you could write a custom data source component. It would be nearly the same code as the script task, but if you have to reuse it it would be a bit easier.
Post #570556
Posted Tuesday, September 16, 2008 1:27 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, November 21, 2008 8:02 AM
Points: 10, Visits: 42
Would you have any example script ?

Post #570564
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse