Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Sonu619
Posting Yak Master
202 Posts |
Posted - 2011-04-15 : 22:29:57
|
Hi everyone,Here is the situation and I need advice from you guys. Every month we receive a file from our client to update any information if they change. Here is the example.Client_ID, Address,Phone121,223 Main Street, 451-869145,458 Jonson Ave, 284-897121,224 MILLER AVE, 623-3125Here is the information that I am getting from client FileClient_ID,ADDRESS,PHONE121,223 MAIN STREET,123-123145,458 JONSON AVE,284-897121,224 MILLER AVE, 623-3125Here Client_ID “121’ he changed his phone number and Client_id # ‘121’ has two houses different address and different phone number, I am using SCD Transformation in SSIS to accomplish this , Here is result that I am gettingCLIENT_ID, ADDRESS,PHONE121,224 MILLER AVE, 623-3125145,458 JONSON AVE,284-897121,224 MILLER AVE,623-3125Please guide me how I can solve this problem, I really appreciate your help. Here is the sample tables for test if some one want to test, Create table Source_File( ID VARCHAR(10),ADDR VARCHAR(30),PH VARCHAR(15))GO INSERT INTO Source_File VALUES ('121','223 MAIN STREET','123-123')INSERT INTO Source_FileVALUES ('145','458 JONSON AVE','284-897')INSERT INTO Source_FileVALUES ('121','224 MILLER AVE','623-3125')GOCreate table Target_File(ID VARCHAR(10),ADDR VARCHAR(30),PH VARCHAR(15))GOINSERT INTO Target_FileVALUES ('121','223 MAIN STREET','458-698')INSERT INTO Target_FileVALUES ('145','458 JONSON AVE','284-897')INSERT INTO Target_FileVALUE ('121','224 MILLER AVE','623-3125')GO |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2011-04-18 : 19:19:00
|
is this a homework or real life situation because I smell a bad design here. do you have a client table? also do you have an address table? are the phone numbers attached to client or address? what phone types are they ? with what you have there is no way of differentiating the rows. if you use client_id then you will most certainly update the wrong row. consider redesigning your approach.If you don't have the passion to help people, you have no passion |
|
|
Sonu619
Posting Yak Master
202 Posts |
Posted - 2011-04-18 : 20:02:00
|
What do you think is a home work or real life situation? and this is sample data because i can't paste 70k rows, so this is just a sample data, i don't think this is bad design, its depend on business, Let me ask you one question because i didn't use a lot SCD Transformation, I can use two Business Key in one SCD Transformation? Here is the answers of the questions that you askeda) Yes i have client table (Source file)b) All information in one source filec) phone types? if you talking about data type , varchar(15)Please feel free to let me know if you have better approach to solve this problem. Thanks. |
|
|
|
|
|
|
|