I searched the textbooks and searchable forum posts for something related to my question, but could not find it. I'm hoping when after I describe my question that it might sound familiar to someone.
First, the context: another department using a black-box database product stopped use of one column and used a different column instead. However, the data in the flat-file export that I need to use for my own database must contain the entire table. If it was a clean binary switch, that would be great: I could split the rows into two groups based on date and deal with it that way. Instead, there was a period of overlap while users slowly got the hang of the practice. This means that I have two columns where a row value is either in one columnor the other.
Now, the question: I currently use SSIS to import this flatfile into an SQL Server table and use a T-SQL script in an SQL Agent Job to handle the problem.However, I was hoping I could do this on the SSIS side while importing the data so that it appears into the SQL Server destination table nice and clean.
This is a HIGHLY SIMPLIFIED view of my system, using dummy data and dummy names. The T-SQL script describes in essence my source and destination table and what I would like to do on the SSIS side. If a screenshot of my incomplete data tab will help, I can do it, but at this point I'm providing what I hope presents the background without presenting distractions.
Thank you for any hints or ideas.
use Learning_Curve; go if OBJECT_ID('dbo.Relation_A','U') is not null drop table dbo.Relation_A; create table dbo.Relation_A ( Rel_A_ID int primary key, Rel_A_Value varchar(20) not null, Rel_B_Value varchar(20) not null ); insert into dbo.Relation_A values (1,'Unknown','Measured'),(2,'Measured','N/A'),(3,'Unknown','Measured'), (4,'Measured','Unknown'),(5,'N/A','Measured'),(6,'Unknown','Measured'); if OBJECT_ID('dbo.Relation_D','U') is not null drop table dbo.Relation_D; create table dbo.Relation_D ( Rel_D_ID int primary key, Rel_D_Value varchar(20) not null ); insert into dbo.Relation_D select a.Rel_A_ID as Rel_D_ID, case when a.Rel_A_Value = 'N/A' or a.Rel_A_Value='Unknown' then a.Rel_B_Value else a.Rel_A_Value end as Rel_D_Value from dbo.Relation_A a; go