| Dinesh 的个人资料Dinesh's Blog ...日志列表网络 | 帮助 |
|
10月24日 SSIS: UNPIVOT TransformationTurning some of columns into rows was one of the tasks had to be done recently. Even though I couldn’t use “SSIS UNPIVOT transformation” for that, I had a chance to play with it. As it is really a useful data flow item for some operations, thought to make a post on it. ProjectName equipments transportation rental software hardware Assume we need to load above information structured like below. ProjectName ExpenseType Amount 10月17日 It loads NULL from Excel to SQL ServerEven thoug it is a known issue, it is worth to blog. You might have seen this problem before and you might have found the solution too. The problem is loading data from Excel into SQL Server. There are some instances that all columns are not populated with values with what excel file has. For example, if we have a excel file (book1.xls) with three columns like below; Col1 Col2 Col3 If we upload this file to SQL Server using import/export wizard, the wizard creats a table with three columns (nvarchar, float and nvarchar) and load all data from Col1 and Col2 but Col3. The thrid column in the table contains null. Even if you use SSIS or procedure with OPENROWSET, you will get the same result. So, what is the problem? Why it does not fill values for Col3? This is because the type and values are determined by first 8 rows in the excel file. Since the first 8 rows do not contains values, Col3 of all rows are populated with null. If one of first 8 rows are filled, that value is used for determining the type of the column. Now how we can correct it? The solution is IMEX option. The IMEX has to be added for the connection string with the value of 1. The below code load all data from excel file without going through first 8 rows. SELECT a.* I couldn't find any property that I can use for setting this option in SSIS's excel source but can be added the option by opening the package through text editor. 10月10日 Have I been avoiding my blog?It has been few weeks now, exams and assignments kept me away from posting anything. As usual, I didn't give much priority for them and finally I was running out of time and had had to complete all within few days. The module for the OBAD (which might be easiest one for me; supposed to be developed within two months), developed within two days but couldn't complete the documentation of it. Whom should I blame? Who else? :) Anyway, decided to do other subjects’ properly-on time. Bought some DVDs, including 24 5th seasons that contains 6 DVDs. Though it was nicely packed, quality is very poor of 24 because it has been captured from TV it seems. Some of other good movies are "Waist Deep - Tyrese Gibson", "Moster House", "Crak". |
|
|