January 18, 2011 at 10:05 pm
SSIS related question, I am converting data from old system/old files to new company Database,
And I am doing everything through SSIS, Here is the problem that I am facing right now, I have to follow data mapping document and in data mapping 4 source fields map with one target field, below are the example
table1.Date_a
table1.Date_b
table2.Date_c Schedule_Date
table2.Date_d
Left side is my “Source Fields” and Right side is my “Target Field”
I can’t add all fields together. Please let me know how I can solved this problem.
Bad solution is run this package four time, but i believe there is some way. Please help me out, Thanks.
January 19, 2011 at 12:28 am
Excuse my speaking plainly, but that is a daft requirement.
What happens if the four source fields all contain different data - you have only one target, so you are going to lose three pieces of information.
You need some additional business logic to deal with the case where you have multiple data items to decide which data to keep and which to drop. That logic could probably be built into a Derived Column, or if it is complex, you may need to use a Script Component to implement it.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
January 19, 2011 at 8:55 am
Phil Thanks for your reply,
This is the requirement and company follow this requirement from last 14 years, Let me post some sample data may be it gives you little idea to solve my problem,
P.K OR ID Table.Date_a Table.Date_b Table.Date_c Table.Date_d
1 Null 12/23/78 null null
2 12/4/98 null null 2/5/99
3 null null 3/24/90 null
Note:- Is there any way when i run my package 1 with Table1.Date_a only grab date and avoid nulls, and same thing rest of the table, at least i can get good amount of data not millions.
I think for now that is only way i can see to solve my problem, Please guide me. Thanks.
January 19, 2011 at 9:14 am
In your original post, you appear to have two tables: "table1" and "table2". In your sample data, you only have one: "Table". If you could post some CREATE TABLE statements and INSERT statements then we'll be able to understand what you have.
That aside, you still haven't explained what you want to do where you have two dates, for example in the second row of your sample data. Which one do you want to insert into your target table?
John
January 19, 2011 at 9:55 am
I am sorry john to confuse to, that was typo mistake, In last post i asked i only need those fields who don't have null value if there is two dates, give me duplicate ID with each dates. Please let me know if my question still not clear i can provide more information. Thanks.
January 19, 2011 at 10:01 am
tooba111 (1/19/2011)
I am sorry john to confuse to, that was typo mistake, In last post i asked i only need those fields who don't have null value if there is two dates, give me duplicate ID with each dates. Please let me know if my question still not clear i can provide more information. Thanks.
Your requirement doesn't make sense - you need to post sample data.
It is impossible to select only fields which are non-null, as in
select [all fields which are not null]
from table
It is, however, possible to select all rows where certain fields are not null
select [all fields which are not null]
from table
where fieldx is not null
PS you should check the T-SQL COALESCE statement. It may give you some of what you want.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply