How to Find Source Table Updated Rows using Tsql Script

Hi Folks,
i have 2 tales Source table and Staging Table. yeaterday I have Imported 24 Million Records From Source table into Staging table. These Table Contain approxmately 42 columns. So today may be some of the updates happend  in Source table rows. ID is the
Unique column.
So may I know which rows are Updated compared to Both tables using Tsql Query. (all 42 Columns might be updated ) .
usually new rows also appeard in sourcetable. I want only Which are Updated not New rows!.
Thanks in Advance.

 SELECT Source.*, Stage.*
   FROM Source
        FULL OUTER JOIN
        Stage
        ON Source.c1 = Stage.c1
           AND Source.c2 = Stage.c2
           AND Source.cn = Stage.cn
 WHERE Source.key IS NULL 
    OR Stage.key IS NULL; 
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • How to find source table

    Hi Experts,
                         Please some one tell me how to find the source table for a structure table. I have table called AFVGD( Structure Table) and AFIH( Transparent Table) , I want to find the physical table where this two tables based on like I want to know Price field is coming from that is existing in AFVGD.
    Thanks
    Robbie

    go to se11 display the structure afvgd.
    the price field PREIS take data element name and it will be PREIS
    and come back to initial screen of se11 go to data type give the name PREIS here in application tool bar you can find the where used list button just click it will pop up some box check tables there and press enter it will display the tables list.
    i think you can find it in AFVC table.
    regards
    shiba dutta

  • How to find which tables are being used by a workbook.

    I was asked by the client to generate a report which will show the Workbook name and it's corresponding tables/views.
    Any idea on how to use the EUL tables for this purpose. I know the SQL query to find the tables in case the workbook was run at least once. But I want to show the Workbook and it's table details even the report was never run.
    Advanced thanks,
    Lokesh.

    Hi Jay
    While we're on the subject of scripts, here's a couple more you might like:
    Script 1:
    =========
    This one shows you how many times an item has been used. It is useful for determining how often users make use of items in a folder. It could be used as research for a materialized view, for dropping items which are not used, or for understanding usage.
    SELECT
    OBJ.OBJ_NAME FOLDER,
    EXP.EXP_NAME ITEM,
    COUNT(QPP.QS_ID) USAGE
    FROM
    EUL5_OBJS OBJ,
    EUL5_QPP_STATS QPP,
    EUL5_EXPRESSIONS EXP
    WHERE
    OBJ.OBJ_NAME = <Folder Name>
    AND OBJ.OBJ_ID = EXP.IT_OBJ_ID
    AND INSTR(QPP.QS_OBJECT_USE_KEY,OBJ.OBJ_ID) > 0
    AND INSTR(EUL5_GET_ITEM_NAME(QPP.QS_ID),EXP.EXP_ID) > 0
    GROUP BY
    OBJ.OBJ_NAME,
    EXP.EXP_NAME;
    Script 2:
    =========
    This one examines the whole EUL and displays a count of the number of times a worksheet has been run by folder. It also shows the date and time of the last run. This one is useful to determine the most and / or least popular worksheets. Adjusting the ORDER BY clause can throw up some interesting results.
    SELECT
    OBJ.OBJ_NAME FOLDER,
    MAX(QPP.QS_CREATED_DATE) LAST_DATE,
    QPP.QS_DOC_OWNER OWNER,
    QPP.QS_DOC_NAME WORKBOOK_NAME,
    QPP.QS_DOC_DETAILS SHEET_NAME,
    COUNT(QPP.QS_ID) USAGE
    FROM
    DRAKE.EUL5_OBJS OBJ,
    DRAKE.EUL5_QPP_STATS QPP
    WHERE
    INSTR(QPP.QS_OBJECT_USE_KEY,OBJ.OBJ_ID) > 0
    GROUP BY
    OBJ.OBJ_NAME,
    QPP.QS_DOC_OWNER,
    QPP.QS_DOC_DETAILS,
    QPP.QS_DOC_NAME
    ORDER BY
    OBJ.OBJ_NAME,
    COUNT(QPP.QS_ID) DESC;
    I'm considering a blog entry of useful EUL scripts. Anyone interested? Yes - either reply here or drop me a line.
    Best wishes
    Michael

  • Urgent-How to find the tables which are used in  DB02 transaction

    Hi,
    Can anybody help me in finding the tables  in Tablespaces tabstrip & Tables n Indexes tabstrip  in DB02 transaction??

    Hi,
    open the following link.
    http://books.google.co.in/books?id=jTTrZjucb_QC&pg=PA37&lpg=PA37&dq=dbo2%2Bsap&source=web&ots=FgA9pC3u24&sig=sOG3EJRm5HGW2aFpkVVH_oxBjjo&hl=en#PPP1,M1
    Master data load failure
    Reward if Helpful
    Jagadish

  • How to find last accessed/updated tables and the query text?

    I am using :
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.4.0 - Production
    How to find last accessed/updated tables and the query text?
    Regards
    LEE1212

    Check DBA_TBALES view there you find one date column that indicate last update
    One option is as follows:
    (1) Turn the auditing on: AUDIT_TRAIL = true in init.ora
    (2) Restart the instance if its running.
    (3) Audit the table:
         AUDIT INSERT,SELECT,DELETE,UPDATE on TableName
         by ACCESS WHENEVER SUCCESSFUL
    (4) Get the desired information using :
         SELECT OBJ_NAME,ACTION_NAME ,to_char(timestamp,'dd/mm/yyyy , HH:MM:SS')
         from sys.dba_audit_object.
    Cheer,
    Virag Sharma
    http://virag.sharma.googlepages.com/
    http://viragsharma.blogspot.com/
    Message was edited by:
    virag_sh

  • HT1338 Can anyone tell me how to find what OS I'm using on the Mac? Tiger or Leopard? Also, how do I update from 10.6.8 to the latest version?

    Can anyone tell me how to find what OS I'm using on the Mac?
    Tiger or Leopard?
    Also, how do I update from 10.6.8 to the latest version?

    Go to the Apple menu and select "About This Mac". You will get a window similar to this one -
    You current OS X version number will be shown as I've marked.
    OS X 10.4.x is Tiger, 10.5.x is Leopard, 10.6.x is Snow Leopard, 10.7.x is Lion, and 10.8.x is Mountain Lion.
    Whether or not you can go to the latest OS X version depends upon your hardware -
    You will need to purchase the retail set for the OS X version you want; there is no pint in getting and installing any intermediate versions. Once the retail version has been installed, you can update it to the latest release for that version via download updater.

  • How to find which table is not being used ?

    Hi,
    I am in need of releasing space from the common schema we have. i have been permitted to drop the tables which has not been used for the last three months.
    Can anyone please suggest how to find the tables that has not been used for a given amount of time.
    Thanks and Regards.
    Rajib

    i have been permitted to drop the tables which has not been used for the last three months.Can I just chip in an observation on this premise? It's not unusual for systems to have processes that run quarterly or even annually. You need to be very careful about dropping "unused" tables - you might just kill your organisations end of year reporting system.
    Is buying more disk space really not an option?
    Cheers, APC

  • How to find ECC tables related to BEx reports

    Hi Experts,
    Say  we have  one particular BEx query.
    When we click the information tab it shows the technical name and also the multiprovider name on which  a particular query is built.
    Now if we LISTCUBE on multiprovider. we can find the Infoprovider supplying the data (0INFOPROV)
    Second comes the datasources which  are bringing the data into DSO/Cube from ECC.
    Q) I am not able to find a way  out to find  what the tables in ECC  involved from which a particular report
    is showing the data in BW (say while reconciliation).
    Would you like to suggest the correct approach or the best way  in this regard??
    Q) Can Extract Structres of these Datasources give the table information??

    Hi Aparajit,
    The easy way to backtrack the data is following the top down approach and there isnt any standard procedure to identify the source table unless you use all the standrd objects in BW and souce with zero customization
    - Identify the report for which you need to track the source table
    - Create a copy of it an enable the  infoproviders in the rows/columns
    - Identify the Info object & key figure for which need to need to know the source and remove the rest from your output. With this you know the underlying DSO/CUBE for ths source of the data
    - Identrify the DSO/Cube is pulling data from ECC OR withing BW data providers
    - Once you know the untimate data source of the respecive DSO/Cube then check if its a custom/standard
    - There are many ways customizing the DS, if the DS is built on View you have the tables straight away, in case of FM check for whereused list to see if there are any underlying tables. (This will need to be done in your source system and not BW). Remember there might be customization in CMOD as well where the data is again extracted from other source tables
    Thanks
    Abhishek Shanbhogue

  • How to find the tables and extractor for my dataload

    Hi all,
    I am new to BW. Can someone tell me which tables and fields I need if I load data (sales report;t code:MCTG; s001)from R3 to BW. Which extractor do I need in LBWE or SWIB?
    I may need to answer as soon as possible. Any hlep will be appreciate. Thank you.
    Koala

    hi,
    you wrote that you have specific requirements for your raport so you should build your own extractors:
    http://help.sap.com/saphelp_nw04/helpdata/en/e9/6bf2d90e533f409ee56d3f586c325a/frameset.htm
    and here you find document how to create delta extractor:
    https://websmp101.sap-ag.de/bi -> infoindex -> delta handling
    and take a look on ...infoindex -> extraction as well
    If you want to build extractor on infoset you can create infoset in sq02
    Extractors in sbiw are not build to extract data from particular tables but as part of data source for BC cubes
    Regards,
    Andrzej
    ps. ...and way I use to find what tables particular transaction use is:
    go to this transaction screen -> system -> status -> copy program name -> go to se38 -> paste program name -> display source code -> and look for statement 'tables:' there will be list of tables this program use (this statement can be under INCLUDE XXXXXTOP)
    Message was edited by: Andrzej Krysiuk

  • How to get source table name

    Hi,
    I need to know how get a source table name. I need to get a source table name and do some transformation. I am adding the step in IKM to do this and therefore need source table name in there.
    <%=odiRef.getSrcTablesList("","[RES_NAME]","","")%> gives work table name (C$_0XXXXX) whereas actual source table name is expected.
    Could someone please help?
    Thanks.

    Hi,
    May i add a point?
    In IKM level, if u use this API it will always return u C$ table name only since for IKM C$ is the source. You need to capture and use this API in LKM level.
    In LKM add a step in Command on target and technology as Jython and try the below code.
    mySourceTable= '<%=odiRef.getSrcTablesList("", "[RES_NAME]", ", ", "")%>'
    And later in IKM use this variable for ur transformation.
    Thanks,
    Guru

  • How to repeat 2 table header rows in adobe form

    Can anybody suggest me how to repeat 2 table header rows .
    one header row is for displaying only columns header list
    second header row is for displaying 'from date' and 'to date'.
    and i want this to be done using layout tab(palletes) in the form.  will it be?
    Message was edited by:
            M Madhu

    loop at ot into wa.
    at first header one
    write second header.
    endloop.
    declear one internal table append both values in come internal table .
    pass the header in comen internal table.
    Message was edited by:
            Karthikeyan Pandurangan

  • How to find the last update date time and user of record field peoplecode

    how to find the last update date time record field peoplecode?
    Thank you.

    One can check the last update date time using the following query
    SELECT LASTUPDDTTM FROM PSPCMPROG WHERE OBJECTVALUE1 LIKE 'RECNAME' AND OBJECTVALUE2 LIKE 'FIELDNAME'

  • How to find full tables hierarchy in schema

    Hi,
    How to find the table hierarchy list from oracle schema by using Reference Key constraint?
    In my schema I am having many tables, approximate 4000 and from there I needs to get a single list which should be based in the Foriegn key based (Parent tables should be first then child tables)
    Regards
    Anee

    You can start with this
    select A.table_name children,
             B.TAble_name Father
    from DBA_CONSTRAINTS A,
            DBA_CONSTRAINTS B
    WHERE A.CONSTRAINT_TYPE = 'R'
         And B.Constraint_name = a.r_Constraint_name

  • How to find out last update date for business partner's marketing attribute

    How to find out last update date for business partner's marketing attribute??
    Im freshie for SAP Application and im assigned to find out last update date for marketing attribute changed
    which table is involved??
    Yours kindness will be appreciated
    thanks

    You can take a look at table AUSP as well as CRMD_AUSP_HIST.
    The "changed by" and "changed at" are logged on attribute level, not on attribute value level. When you change one specific value, the system does a "re-insert" of all existing values of this attribute.
    Take a look at the SAP notes 938426 and 966670  these may assit you in resolving the issue.
    Regards,
    William Laverde

  • How to reference source table in procedure?

    I created a procedure with only 1 sql statement:
    delete * from source_table_name@connector where ...
    I put this procedure in pre-mapping, then validate, pre-deploy are both ok, but when I deployed it, it caused "cannot find table or view" error.
    How to reference source table in the procedure? Thanks.

    anybody helps??? Please.
    Thanks.

Maybe you are looking for

  • Incoming texts going to old phone instead of new one.

    I upgraded from iphone 4 to Nokia Lumia 928. I can call out, receive calls, and send texts on the Nokia, but all incoming text messages are still sent to my iphone. Any ideas on how to fix this? It's not real handy having to carry two phones around.

  • .Mac sync no longer working

    Since a few days ago, .Mac syncing of my bookmarks stopped working. I noticed that all the bookmarks I added on my G5 stopped showing up in .Mac and on my laptop. However bookmarks added on the laptop would show up on .Mac, too. So I decided to unreg

  • Login/Password required when it shouldn't be. Why?!

    I used to be able to visit this main website: gwbweb.wustl.edu This should absolutely not require a password, yet when I type it in and press enter, this appears: "To view this page, you need to log in to area "gwbweb.wustl.edu" on gwbweb.wustl.edu:8

  • Clean Access Can't Find Check_Point Definitions

    I'm running a clean access system with all the newest code and I'm trying to allow ZoneAlarm AV (CheckPoint). The agent detects the installation fine, but it can't detect the definitions...any ideas? From Clean Access Agent Reports: AntiVirus Install

  • How do I download creative cloud that I just purchased on line

    How do I download Creative Cloud I just purchased online.  I am on the Apps & Service: Adobe page.