June 16, 2009 at 10:10 am
Another way is to add a "Derived Column Transform" and use the expression "?" with a default value that replaces null.
Example: ISNULL([testColumn])?0:[testColumn]
Raj
October 21, 2009 at 3:32 pm
How about this simple solution:
http://blog.tylerholmes.com/2007/12/walkthrough-connecting-to-excel-2007.html
😛
October 21, 2009 at 4:04 pm
Raj,
If you add that expression, you will indeed not have a NULL in the column, but that doesn't help the case where there was actual data in the column that was lost because the JET driver looked at the column and treated it as a FLOAT instead of a CHAR(255). The best example I have for this is Zip+4 codes mixed with Zip codes in a single column. Excel will read the column, see that the majority are FLOAT and will treat anything with a hyphen as a NULL for purposes of import because it's not a FLOAT. That defeats the purpose.
JW,
That solution looks okay, but as one person commenting on it noted, it forces everything to a char(255) and you lose any Memo data that might have been stored. If one of your columns is > 255 characters, you lose the data. You also then have to deal with everything that is now being treated as a char(255) and any odd conversions that happen as a result. That in itself shouldn't be too bad, but it is a pain. It's also kind of frustrating because you can't set that option when using the Wizard. You need to code for it. 😛
As noted in one of my earlier posts, I deal with this when receiving files from customers that have multiple sheets (making it impractical to try to export and choose a good delimiter), a mixture of data-types, and usually with some Note/Memo data. That leaves me with a lot of pain points when trying to load data directly from Excel. And there are a lot of workarounds, but hopefully people will be aware that there are definitely some areas to watch for when importing Excel using SSIS.
October 21, 2009 at 4:11 pm
I found the answer - use a conditional split - work out which column can never be null for a valid row, divert all of the rows that do NOT fit that condition in to the remainder of the data flow
Easy....innit....dunno why it stumped me for so long!
January 5, 2010 at 3:24 pm
I'm having a similar problem to this but it is localised to my machine only. My colleague wrote a package to import an Excel spreadsheet in SQL Server. It works perfectly on his machine but when we transferred the package/solution in its entirety to my machine, the behaviour described in this forum appeared on mine. Does anyone have any ideas why this might be the case. We have the same software version and all drivers on both our computers are the same.
January 5, 2010 at 3:40 pm
Perhaps he has the registry settings for IMEX or similar set differently on his machine? If you can be more specific with the issues, that might help some. My best guess is that your colleague's registry settings are different than yours.
January 5, 2010 at 4:23 pm
First of all, regarding registry settings, noone in our office can edit registry settings, at least through regedit as it has been disabled for use across the organisation.
As far as more information:
The column I refer to has dates in. There are around 1000 rows of data. The first three rows in the particular column are empty. Then there are a few dates and the pattern sort of repeats itself like that. When the data is previewed in SSIS, the first three rows show as empty for that column but every row with a valid date in shows as "NULL".
January 5, 2010 at 4:39 pm
Use a derived column to convert the datestring to the format yyyy-mm-dd RIGHT(thedate,4) + "-" + SUBSTRING(thedate,4,2) + "-" + SUBSTRING(thedate,1,2)
as a unicode string (DT_WSTR) then convert that (data conversion) do a date (dt_date). This is what works for me.
January 5, 2010 at 4:57 pm
Sounds very much like the registry settings may have been edited - perhaps with a support ticket or similar. That sounds suspiciously like the option to read all rows in a column to determine its type. Otherwise, your package could be treating that column as just about any other type and running into issues w/ conversion.
I assume that you've verified for all of the non-NULL columns that the data contains a valid date and not something that's almost a date. Is it possible that it's trying to read in some slightly different format for the date and choking on that? Perhaps trying to read dd-mm-yyyy instead of mm-dd-yyyy or yyyymmdd?
Without knowing too much more about the file(s), is it also possible that the files that have run successfully have had fully populated date columns? I know that once you release a spec into the wild you don't really know what you'll get back.
August 19, 2011 at 4:50 am
Thanks thejackfy 🙂 Great workaround!
August 23, 2013 at 2:03 am
make in registry editor for excel typeguess rows= 0then it will consider datatype using all the data inside column but it may be huge performance issue
but i know it resolves the problem of loading null values
October 11, 2013 at 10:35 am
Hi,
Please send the script for downloading data from excel.
Thanks & Regards,
Praveen
Viewing 12 posts - 31 through 41 (of 41 total)
You must be logged in to reply to this topic. Login to reply