Insert three values for each record

I have a very complex Data Flow, with several joins, splits, etc.... once all of this logic is completed, I need to insert the values 2013, 2014, and 2015 for a Derived Column (called Year).  Each record that comes through this data flow needs to have
a duplicated entry three times, and insert these values for the year.
Here's a simple example source:
Key Name
1 Brandon
2 Thomas
So the target should end up being:
Key Name
Year
1 Brandon
2013
2 Brandon
2014
3 Brandon
2015
4 Thomas
2013
5 Thomas
2014
6 Thomas
2015
Can anyone help?
There are only 10 types of people in the world... those who know binary, and those who don't.

Hi,
Try this,
1. Load the data into your destination with 2013 as a derived column.
2. Have an another Dataflow task to load one more time. (Select the distinct record from dest table - have an id key and take distinct based on that or please check for your data nature). After selecting the distinct records, have 2014 as derived column
in that DFT.
3. Again have another DFT to load for 2015.
This is a static method since you have only 3 years to insert. If you have more years like this, do a loop to achieve this logic.
--------------------Mark as Answered or Vote as helpful if this solves your problem.------------------

Similar Messages

  • How to have a unique value for each record??

    could any 1 help me out in this...
    I want to have a column name 'Order No' which should be unique.
    How to generate a unique value for each record.??

    could any 1 help me out in this...
    I want to have a column name 'Order No' which should be unique.
    How to generate a unique value for each record.?? If you are using SQL PLUS to create the table try something like
    this:
    CREATE TABLE ORDER_TEST (
    ORD_NO NUMBER (8) NOT NULL PRIMARY KEY,
    ORDERDATE DATE,
    CUSTID NUMBER (8) NOT NULL,
    SHIPDATE DATE,
    TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
    (TOTAL >= 0),
    CONSTRAINT ORD_FOREIGN_KEY FOREIGN KEY (CUSTID) REFERENCES
    CUSTOMER (CUSTID),
    CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
    -- or a simpler table example
    DROP TABLE ORDER_TEST;
    CREATE TABLE ORDER_TEST (
    ORD_NO NUMBER (8),
    ORDERDATE DATE,
    CUSTID NUMBER (8) NOT NULL,
    SHIPDATE DATE,
    TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
    (TOTAL >= 0),
    CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
    note: ORD_NO can also be a primary key
    If you are doing the INSERT during runtime from a form first
    create a sequence in SQL PLUS to handle the ORD_NO value:
    Create SEQUENCE ORDERNO_UNIQUEVAL_sqnc
    START WITH 000001
    NOMAXVALUE
    NOCACHE;
    and reference it as the ORD_NO parameter in your INSERT
    statement:
    ORDERNO_UNIQUEVAL_sqnc.NEXTVAL
    note: to maintain data integrity you must use the sequence
    everytime you insert a new order to table. To start a new
    sequence drop the sequence and re-create it with whatever "START
    WITH" value you want.
    Hope this helps
    Kevin

  • How to show multiple values for Unique records in Report

    Here's my question/problem:
    I've joined two tables, one table (TBL1) contains an object id (OBJ_ID) that repeats and the other table (TBL2) contains a date (DT), object type id (OBJ_TYP_ID), and object type description (OBJ_TYP_DES). The tables are joined by an inventory id (INV_ID).
    The OBJ_ID repeats and has a Date value for each record. I want to report an unique OBJ_ID and show each Date for a particular OBJ_ID in multiple Columns.
    An example of the current resultset looks like this:
    OBJ_ID OBJ_TYP_ID OBJ_TYP_DES DATE
    1 1 TYPE1 4/1/2009
    2 1 TYPE1 4/1/2009
    3 1 TYPE1 4/10/2009
    1 2 TYPE2 5/3/2009
    3 1 TYPE1 3/30/2005
    4 1 TYPE1 4/1/2009
    5 1 TYPE1 4/1/2009
    5 2 TYPE2 5/1/2009
    1 1 TYPE1 4/3/2007
    1 1 TYPE1 3/30/2005
    I want to express the resultset like this:
    OBJ_ID OBJ_TYP_ID OBJ_TYPE_DES DATE1 DATE2 DATE3
    1 1 TYPE1 4/1/2009 4/3/2007 3/30/2005
    1 2 TYPE2 5/3/2009
    2 1 TYPE1 4/1/2009
    3 1 TYPE1 4/10/2009 3/30/2005
    4 1 TYPE1 4/1/2009
    5 1 TYPE1 4/1/2009
    5 2 TYPE2 5/1/2009
    What technique is best to use to do this? I know I could create another table and populate the rows/columns by reading data from this query, but is there a better way?

    Hi,
    cclemmons wrote:
    I want to express the resultset like this:
    OBJ_ID OBJ_TYP_ID OBJ_TYPE_DES DATE1 DATE2 DATE3
    1 1 TYPE1 4/1/2009 4/3/2007 3/30/2005
    1 2 TYPE2 5/3/2009
    2 1 TYPE1 4/1/2009
    3 1 TYPE1 4/10/2009 3/30/2005
    4 1 TYPE1 4/1/2009
    5 1 TYPE1 4/1/2009
    5 2 TYPE2 5/1/2009
    What technique is best to use to do this? I know I could create another table and populate the rows/columns by reading data from this query, but is there a better way?Absolutely! You seem to have an instictive feeling that creating a separate table just for a query is inefficient. You instinct is 100% correct. Maybe in Oracle 7 there was a reason to do that, but today you can query results of other queries as if they were tables, so temporary tables like you describe are very rarely necessary, let alone convenient.
    What you want to do is pivot the date columns. Here's one way
    WITH     original_query     AS
         SELECT  obj_id
         ,     obj_typ_id
         ,     obj_typ_des
         ,     dt          -- date is not a good column name
         FROM     ...          -- the rest of your original query goes here
    ,     got_rnum     AS
         SELECT     oq.*
         ,     ROW_NUMBER () OVER ( PARTITION BY  obj_id
                                   ,                    obj_typ_id
                             ,             obj_typ_des
                             ORDER BY        dt     DESC
                           )         AS rnum
         FROM    original_query        oq
    SELECT       obj_id
    ,       obj_typ_id
    ,       obj_typ_des
    ,       MAX (CASE WHEN rnum = 1 THEN dt END)     AS dt1
    ,       MAX (CASE WHEN rnum = 2 THEN dt END)     AS dt2
    ,       MAX (CASE WHEN rnum = 3 THEN dt END)     AS dt3
    ,       MAX (CASE WHEN rnum = 4 THEN dt END)     AS dt4
    ,       MAX (CASE WHEN rnum = 5 THEN dt END)     AS dt5
    FROM       got_rnum
    GROUP BY  obj_id
    ,       obj_typ_id
    ,       obj_typ_des
    ;As you can see, this adds two layers of queries on top of your original query. One of those layers is probably not needed; depending on what you're doing in your original main query, you can probably compute rnum there, and omit the got_rnum sub-query.
    Also, depending on the relationship of obj_id, obj_typ_id and obj_typ_des, some of what I posted above may not be needed but including it won't really hurt.
    If you want to know more about this technique, search for "pivot" or "rows to columns". A <tt>SELECT ... PIVOT ...</tt> keyword was introduced in Oracle 11, but most of what you'll find when you search for "pivot" doesn't assume you have Oracle 11 (nor does the query above require Oracle 11).
    This assumes you know an upper limit (5 in the example above) of dts that can appear in any line of output.
    See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3527823&#3527823] for a discussion of some alternatives.

  • Inserting values for all records except 1 or 2 column ,without specify column names.,?

    Hi,
    for example, in student table i am having 1000 columns,  column names like(id ,name,class, dept,etc,.).
    i want to insert 998 fields to department table from student tables except(id,class).
    i don't want to mention all column names in the insert command,
    is there any possibilities to filter the column names in insert command like (EXCEPT, NOT IN).
    Thanks in advance..

    duplicate of
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b31fa034-5b8f-42e4-b4e1-592a632ca6a5/inserting-values-for-all-records-except-1-or-2-column-without-specify-column-names?forum=sqlce
    please dont cross post
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • From XML (import) for each record automatic new page creation?

    Hello,
    I'm playing around with XML.
    Can someone tell me where to look and help me?
    I load variable data via XML.
    Example content xml:
    <pages>
         <page>
             <id>1</id>
             <article>title page 1</article>
             <info>Info page 1</info>
             <price>price page 1</price>
         </page>
         <page>
             <id>2</id>
             <article>title page 2</article>
             <info>Info page 2</info>
             <price>price page 2</price>
         </page>
         <page>
             <id>3</id>
             <article>title page 3</article>
             <info>Info page 3</info>
             <price>price page 3</price>
         </page>
    </pages>
    I have 1 page classified (ie 3 text boxes). The idea is that for each record in the xml (in this case 1, 2 and 3) a new page is created (Qua layout identical to the page that I had prepared, but with the corresponding data in each box)
    How do I do this?
    Thanks!

    If you need to keep the three parts of your page in separate text frames, you are probably out of luck.
    I can't tell from your question whether you know how to tag frames and import XML content into them. If you don't, the manual is fairly clear on it. However, it states more than once that "InDesign flows merged XML content into existing frames only."  That means that it won't add frames or pages for you -- you can only load XML into tagged frames on the first page and will have to add extra ones by hand.
    If you could rework your design so that all the elements could be accommodated in a single text frame, using paragraph styles to keep them apart, you could just import the XML and map tags to styles, then drag it into a frame on the first pages. If your article style was set to start in a new frame,  everything but the first would go into overset text, which you could deal with in the usual way -- shift-click on the in port of a new frame and InDesign will add the pages you need.

  • Graphical mapping question - need to create 2 nodes for each record

    The mapping is from flat to nested, i.e. flat file to FIDCC2 idoc. Each record has to go to 2 repeated IDoc segments, each one with different posting key. Right now, I have it working for each record to a segment(for one segment) by using splitByValue (value change). How can I repeat the creation of another but with slightly different constant.
    Also, how do I add line numbers? I remember seeing a posting on this a while ago - cannot locate it.
    Will be Rewarded WELL.
    Thanks,
    Pam

    Hi, Pam
    Using the following example to store it as global variable
    SetParameter from GloabalContainer:
    container.getGlobalContainer ().setParameter ("COUNTER", "0");
    GetParameter from GloabalContainer:
    String myCounter = (String) container.getGlobalContainer().getParameter ("COUNTER");
    When you map to your constant, store it in global variable, then you map other field, get current global variable, check its value, based on the value, you do proper mapping.
    Hope it helps
    Liang

  • How to append parameter with URL for each record in table control?

    Hi,
    I have one table control which contains 5 columns.
    (tripno, startdate, destination, reason, activities)
    In 5th column, i need to display URL for each record.
    for ex:
    www.abc.com/test?tripno=1
    www.abc.com/test?tripno=2
    www.abc.com/test?tripno=3
    when user clicks a particular hyperlink, it navigates to another page/component thru URL with one key field(tripno) to retrieve related records in next page.
    1) i am not able to assign tripno to each record. when i assign tripno, its taking the last value which i assigned. ie. tripno=3 only.
    How to assign URL to Reference field of LINK_TO_URL element at run time?
    OR
    2) we can do like this.
    Simply assign url to reach record without key field.
    www.abc.com/test
    www.abc.com/test
    www.abc.com/test
    when user clicks a particular link, we can assign corresponding key field to the URL.
    Where should i write this event? Bcoz, LINK_TO_URL doesnot have event.
    how to do?

    Hi MOg.
    Not sure whether I understand you .. but in the 5th column you want to have the reference URL. Is this the activities columen from you example?
    Nevertheless, you need a attribute (String) in your context node which contains the URL. Bind this to the reference filed of linktourl. If you can not extend the structure you can create a sub node (cardinality 1:1)  which contains the refernce attribute.
    Then loop over all elements and concatenate www.abc.com/test?tripno= with the tripno of the current element into the reference field.
    Hope tis helps,
    Sascha.
    Bind the

  • Calling Procedure for each record ?

    Hi,
    I am using a procedure in a mapping.
    I defined the procedure which is having 4 out parameters.
    I am assigning these default values to the tables in a mapping.
    When I see the generated code in a mapping, I observed that, the procedure is being called for each record.
    But actually, its enogh to be called only once.
    Could any one please help me, how can I restrict the procedure calling for each record.
    Any help would be greatly appreciated.
    Thank you,
    Regards,
    Gowtham Sen

    Hi,
    U can use MAP-INPUTS operator to give the inputs to the procedure and use a PRE_MAPPING operator to call the procedure. this way even if u feel u want to make the mapping running thru an scheduler u can still use it without changing the code.
    Regards
    Bharath

  • How do I store images uploaded by end users for each record?

    I am writing an application which requires end users to upload an image for each record they add. There could be thousands of images, and they are exclusive to this app. I use a File Browse item in order to let the user choose an image file to upload.
    But all I have managed to achieve at the moment is storing the full pathname of where the image is on the users machine, which means they can see the images they upload but no-one else can! Obviously not practical. I haven't figured out how to actually upload the images to the server and achieve multi-user access from there.
    My questions are, where is the best place to store these images, in the database or in a folder on the server? And what setups do I, or the DBA, need to do for both of these scenarios in order to save the uploaded images and display them.
    Hopefully someone can give advice, or point me to some documentation explaining this procedure. Thanks in anticipation.
    Rick.

    Hi
    The file you upload can be found in APEX_APPLICATION_FILES view. If you are want to store the file as BLOB in your table you can use the code similar to:
                 SELECT BLOB_CONTENT, FILENAME, MIME_TYPE
                 INTO    v_blob, v_actual_name, V_MIME_TYPE
                 FROM   APEX_APPLICATION_FILES
                 WHERE name = :P216_FILE;Or directly insert in your table using
                 INSERT INTO ......... (.....)
                 (SELECT BLOB_CONTENT, FILENAME, MIME_TYPE
                 FROM   APEX_APPLICATION_FILES
                 WHERE name = :P216_FILE);-----
    Zulqarnain
    http://www.maxapex.com
    Low Cost, High Quality Hosting for Oracle Apex

  • Error in BP: insert valid value for bp

    Hello experts,
    we use msa 50sp11 and it works fine, but sometimes
    we have problems with creating/changing activitis to a bp:
    error in BP: insert valid value for bp     -   error 2007 mtbfll
    This happens after the user have made some changes to the bp and
    replicated it. Then sometimes we get this error.
    On other client with the same bp, there I do not get this error althoug the changes are there too.
    When I then download an extract 'customer hierarchy' to the affected client, then
    the user can work with the bp without problems again.
    Does anybody know what there the problem could be ?
    Thanks
    Gerd

    I am so pleased to see this post on the forum.
    We have been having exactly the same issue intermittently since upgrading to SP11 but it is incredibly difficult to replicate.
    It looks like a short record is missing but when checking the entry in SMOKNA1SHT, it has a full record there.
    For us, we have generally seen it when navigating from the calendar, and then clicking the back button and for some reason, it does not seem to call the record from SMOKNA1SHT properly.
    Closing MSA and reopening fixes it.
    I believe that we raised an OSS but it is so difficult to replicate, it makes it vitually impossible to troubleshoot.
    We are actually going to be replacing SMOKNA1SHT with a view in January, so it will be interesting to see if that fixes the issue - if it is framework, then it should not.
    As well as the reported message, we had another one in the background that was half in English, half in French saying something like "Transferring the objects from cMSAActivities in section _IAC failed. Details: Not possible to carry out a cast from an object of type 'MSA.SCalendarTS' to type 'MSA.SMSAACTactoverview'"
    That may not be the exist message as my French is a little shaky
    Just so you know that we share the pain of this error
    Regards
    James

  • TSQL Get Previous values for each group by

    Dear Friends,
    I have a problem with my TSQL statment. 
    I need to get previous value for each day and specific unit. Everything goes fine if I have always 2 unit in each day. But if same day has just one unit or less, I cannot have the previous value in the current record.
    The Output is this one:
    SK_DAY SK_UNIT
    VALUE VALUE_PREVIUS_DAY
    20131112 2
    30.00 NULL
    20131112 3
    34.00 NULL
    20131113 2
    40.00 30.00
    20131113 3
    45.00 34.00
    20131114 2
    50.00 40.00
    I dont have the second record for 2013-11-14, because in this date I just have value for unit 2.
    The final output should include the record:
    20131114 3
    0 45.00
    The Statment I have is:
    SELECT MAIN.SK_DAY, MAIN.SK_UNIT, SUM(MAIN.VALUE) AS VALUE
     SELECT SUM(VND1.VALUE) AS VALUE
     FROM FCT_TEST VND1
     WHERE CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))>=DATEADD(dd,-1,CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY)))
    AND CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))<CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY))
    AND VND1.SK_UNIT=MAIN.SK_UNIT
    ) AS VALUE_PREVIUS_DAY
    FROM FCT_TEST MAIN
    GROUP BY SK_DAY, MAIN.SK_UNIT
    SQL CREATE SCRIPT:
    CREATE TABLE [dbo].[FCT_TEST](
    [SK_DAY] [int] NOT NULL,
    [SK_UNIT] [int] NOT NULL,
    [VALUE] [decimal](18, 2) NULL,
     CONSTRAINT [PK_FCT_TEST] PRIMARY KEY CLUSTERED 
    [SK_DAY] ASC,
    [SK_UNIT] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Thank you!!!
    PPSQL

    Thank you Kalman,
    But my problem is not with date! Fortunately I have dates for all days.
    The problem is for dimension tables like UNITS that I dont have values for all days, and when I try to get the previous value for previous day and each unit I dont have records. 
    20131112
    2
     30.00
    NULL
    20131112
    3
     34.00
    NULL
    20131113
    2
     40.00
    30.00
    20131113
    3
     45.00
    34.00
    20131114
    2
     50.00
    40.00
    20131114
    3
     0
    45.00 [I NEED THIS RECORD AS IS]
    Could you help me??
    Thank you!!

  • :new., lob columns and after insert ... for each row trigger

    I'm having this little problem with
    my update/insert triggers and lob columns.
    I have this little trigger:
    CREATE OR REPLACE TRIGGER BLOB_DATA_INSERT
    AFTER INSERT ON BLOB_DATA
    FOR EACH ROW
    BEGIN
    INSERT INTO BLOB_DATA_CHANGE VALUES(CHANGE_SEQ.NEXTVAL, 'I', :NEW.ID,:NEW.DATA);
    END;
    Which works except when the DATA column
    is a BLOB or CLOB (There is no data in :NEW.DATA. I even tried some of the DBMS_LOB package procedures)
    The one thing that is different for the lob columns is that the application updating
    the data is using a bind statement with returning, like:
    INSERT INTO BLOB_DATA
    VALUES(:ID,EMPTY_BLOB())
    RETURNING DATA INTO :DATA;
    COMMIT;
    Thanks for any help

    I'm having this little problem with
    my update/insert triggers and lob columns.
    I have this little trigger:
    CREATE OR REPLACE TRIGGER BLOB_DATA_INSERT
    AFTER INSERT ON BLOB_DATA
    FOR EACH ROW
    BEGIN
    INSERT INTO BLOB_DATA_CHANGE VALUES(CHANGE_SEQ.NEXTVAL, 'I', :NEW.ID,:NEW.DATA);
    END;
    Which works except when the DATA column
    is a BLOB or CLOB (There is no data in :NEW.DATA. I even tried some of the DBMS_LOB package procedures)
    The one thing that is different for the lob columns is that the application updating
    the data is using a bind statement with returning, like:
    INSERT INTO BLOB_DATA
    VALUES(:ID,EMPTY_BLOB())
    RETURNING DATA INTO :DATA;
    COMMIT;
    Thanks for any help

  • Create id, update id with date for each record

    Hi,
    Please give me brief idea or document for this concept:
    I need create id, create date, update id, update date for each record inserted or updated in database (in few tables).
    1) how user id can be obtained?
    2) Is it better if i use views instead of tables for this?
    3) is it possible for each record?
    Please show me complete scenario. a piece of code can also be helpful.
    thanx in advance.

    only.ashish99 wrote:
    Hi,
    Please give me brief idea or document for this concept:
    I need create id, create date, update id, update date for each record inserted or updated in database (in few tables).
    1) how user id can be obtained?SELECT
    2) Is it better if i use views instead of tables for this?It depends.
    post EXPLAIN PLAN for both.
    3) is it possible for each record?yes
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • How to genarate Primary Key for each record in XI  Mapping

    Hi,
    I need to genarate primary key for each record in the paylod in mapping..
    Eg: if i have a 10 reacords i need to have a primary key for each record..starting with the
    Record      Primary key
    First            001
    Secound      002
    Tenth         010
    If i need to write any user defined funtion... can any one provide the code for it.
    Thanks
    Amaresh

    Hi Bavesh,
    I will explain with the example:
    XML:
    <Record 1>
    <Primary key>
    <value1>
    <value2>
    </Record 1>
    <Record 2>
    <Primary Key>
    </Record 2>
    like above i will be getting n number of recored and in each record i need  to genarate primary key in XI.and the key sould be in sequence...
    like for the first record 1 secound 2 like that primary key should add to the privous Primary key.
    and this is for each payload.
    Thanks
    Amaresh

  • SSRS 2008 R2 - Separate report for Each record?

    Hi,
    How do I create new pdf reports for each records from a table? The pdf files should be named as customerid.pdf and needs to be delivered in email or share path? 
    Each record has enough content for 5 page of pdf report.
    How do we achieve this?
    Thanks
    Raj

    You can create a data driven subscription to loop through records in the table and create pdf based on number of customerid.
    Have a look at this for DD subscriptions :
    http://msdn.microsoft.com/en-us/library/ms169673.aspx
    Kind Regards, Vikram Kansal Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker

Maybe you are looking for

  • Error M7 146 : Special Stock E not supported

    Hello Everybody, We have the following situation and would request your suggestions:- In VL01N, we are trying to do a PGR via Returns Delivery (Delivery Type LR) for a Make-To-Order product. The system gives the error M7 146 "Special Stock E not supp

  • How do you remove a badge number from the app store without downloading...

    HOw do you remove the badge number icon for a program that you do not want to update from the app store. I have an app that is updated but i don't want the update (new ugly artwork and I am content with what the present artwork and app does)...I don'

  • PS Album 3.0 Crashes When Importing

    When I try to Import my twelve thousand image files from my "C" drive, the files are found. But when I go to Import them, the program dies after between couple of hundred and several thousand imports and I have to end it with Task Manager. Any sugges

  • Bex : Run-time Error '13' - Type Mismatch

    Dear, I have a trouble with BEX. With some user, they can not start BEX. When They start BEX, they have the Run-Time Error '13'  type mismatch. With a administrator account, we have not problem. When I go in the debug, it stop on "addIn.RunAutoMacros

  • I encountered a problem saving a document I just wrote, can someone help me?  See my summary

    I'm having trouble saving a document.  I  copied and pasted a graphic onto the page and was about to save the project when a spinning colorful wheel appeared. It will not allow me to do anything, let alone save the document.  I don't want to loose th