ABAP / Query to Identify Duplicate Rows in Cube

Dear Experts,
We have a situation were some of our Cubes (due to compression and varying levels of forceful reloads) now contain duplicate rows.
What I need to know is :-
1) Is there a way to identify duplicate rows where one of the characteristics are different but all key figures are identical.
2) If so what is easier to achieve, ABAP routine/program or Query
3) If ABAP suggestions on how to code such
4) If query same.
What I need it to do is tell me which ClaimNo record (Primary Key) has duplicates and what characteristic has caused it.
I know I am asking for a lot but I really need to get this resolved as it's causing mayhem and trying to pinpoint these records is both time consuming and painful.  What we are looking to do with the records is establish how they became duplicated so we can prevent this happening in the future.
Your help as always much appreciated.
Regards
Craig
Message was edited by: Craig Armstead

Hi Craig,
My previous answer can find out what all cubes and data targets have been loaded based on a request.
Actually for your query. The following information will be surely useful.
tables: /BIC/**(source ) , /BIC**(target)
parameter : fieldname like /BIC/****-fieldname ( In ur case the it can be primary key or Duplicate entry )
data: itab_source  like /BIC/*** occurs 0 with header line,
      itab_destination like /BIC/*** occurs 0 with header line.
data: wa_itab_destination like line of itab_destination.
select *
  from /BIC/*****
  into corresponding fields of table itab_source.
  where fieldname = fieldname.
******Include your piece of code which is for deleting records
Delete adjacent duplicates from itab_source comparing characteristic ( i.e  duplicate characteristic you specified)
****Use this to delete the ODS Data before writing into it
call function 'RSDRI_ODSO_DELETE_RFC'
  exporting
    i_odsobject  = 'ODS Name'
    i_delete_all = 'X'.
if sy-subrc = 0.
  loop at itab_source.
    move-corresponding itab_source to itab_destination.
    append itab_destination.
  endloop.
  modify /BIC/*** from table itab_destination[].   “target being written from itab.
  commit work.
endif.
Please Reward points if this helps really.
Thanks,
Srinivas.

Similar Messages

  • SQL Query to identify duplicates

    Hi All,
    I want to identify and display some duplicate data from the database.
    With duplicates I mean rows in a table that contain identical information in a combination of fields (Last Name, First Name, City).
    Example:
    ID1     ID2     Last Name First Name  City               Phone
    1005  2010    Krieger      Jeff             San Ramon     9252997100
    1012  2010    Krieger      Jeff             San Ramon     9252997100
    1017  2010    Krieger      Jeff             San Ramon     9252997100
    Now I want to select the IDs (ID1 and ID2) that identify each duplicate rows.
    Therefore I want to create a query with a subquery inside, similar to this:
    SELECT ID1 ID2 LastName FirstName
       FROM Customers
       INTO TABLE
       WHERE (LastName FirstName City) IN
       (SELECT LastName FirstName City
           FROM Customers
           GROUP BY LastName FirstName City
           HAVING COUNT(*) > 1)
       ORDER BY LastName FirstName.
    How would be the syntax in ABAP, because I am not able to define more than one field after WHERE?
    Any Ideas how to identify the duplicate data and return the ids?
    Thanks for any help!

    Is this something you need to do via code or can you use an analysis tool?  TAANA & TAANA_AV allow you to analyze distribution spreads by table fields (you can pick your table and the fields).  It's primarily used for archiving analysis but it's helpfuul in other scenarios as well.  It's not optimal for finding single record dupes but I thought I'd throw it out there.

  • Would like to change the "Retrieve duplicate rows" Query Prop to unchecked

    Currently the Query Property "Retrieve duplicate rows" is checked (selected) by default.
    For our users, the typical case would be to NOT retrieve duplicate rows.
    Thus, we would like to change the default setting for the "Retrieve duplicate rows" query property to
    unchecked (not selected).
    Is there a way to do this?
    Thanks in advance.

    Is there a way to do this?
    No. Not easily/out of the box.
    The only way I can think off to do this would be to use the Enterprise and Webi SDKs.

  • Querying view gives multiple rows

    I have a query that returns duplicate rows (5) when I write the query this way:
    "Select *
    from view v
    , table_A a
    where v.key = a.key"
    However, if I write the query this way, the correct data is returned, i.e., only one row.
    "Select *
    from (select * from view v)
    ,table_A a
    where v.key = a.key"
    It also works correctly if I put the in-line view in the select portion of the select statement.
    Any ideas?
    Thank you for your help,
    Tricia

    With the second query, I get "ORA-00904: "V"."KEY": invalid identifier". Are you sure that it ran ok for you? v.key is out of scope in the where clause...
    If I label the subselect as v, I get the same result as the first query - 5 rows.
    Message was edited by:
    Boneist
    (I can't spell)

  • Abap Query - Delete duplicates

    I
    I'm doing an abap query in SQ02 with LIKP and LIPS tables.
    As output I just want lines with different entries in LIPS of material.
    How can I delete the duplicates? With instruction delete ADJACENT DUPLICATES FROM XXXX COMPARING vbeln matnr, how can I identity the table?
    Thanks
    Dora

    Hello Dora,
    It is a very well known difficult task to use 'Delete Adjacent Duplicates' syntax in Infoset Query because of the fact that you are not aware of the internal table.
    Two methods to address this:
    1. Study the repeating lines and use another suitable join in the tables manually, which can eliminate the undesirable duplicates.
    2. The other one I always practiced was, Study all fields of the repeating lines. Identify at least one the field value which is not same in these duplicate lines. Suppose you have a field ABCD and values X in one and Y in other. And you have decided to have the lines with value X. Then give the following syntax in the Record Processing section of SQ02.
    CHECK TABLE-ABCD = 'X'. 
    This would remove the lines with Y.
    KJogeswaraRao

  • How to write the query to find the duplicate rows?

    Hi,
    How will I find the duplicate rows in the table?
    I have a table called ITEM
    Select item_no,mfg_id from item
    Item Mfg_ID
    178 06278
    178 06589
    238 5489
    289 7895
    289 7596
    Now I want to find only the duplicate rows i.e.,178 & 289 is coming twice.
    How will get the all duplicate rows in the table?

    nihar2 wrote:
    Convert to
    SELECT it.item,
         im.mfg_item,
         im.manufacturer,
         im.description
    FROM (SELECT it.item,
         im.mfg_item,
         im.manufacturer,
         im.description,
         count(it.item) over(partition by it.item order by it.item) cnt
         FROM item it,item_mfg im
         WHERE it.u##item=im.u##item)
    WHERE cnt > 1
    But I tried It show not valid identifier.You can't use the table aliases from the sub-query...
    SELECT item,
           mfg_item,
           manufacturer,
           description 
    FROM (SELECT it.item,
           im.mfg_item,
           im.manufacturer,
           im.description,
           count(it.item) over(partition by it.item order by it.item) cnt
      FROM item it,item_mfg im
      WHERE it.u##item=im.u##item)
    WHERE cnt > 1

  • Duplicate rows on Query with journal entries and AP documents

    Hi Experts,
    I ahve the below query allowing me to have some information from journal entries and retrieve some other from AP docuements and PO.
    The thing is the query duplicates rows because the AP docuements have several rows but i don t know how to do to remove them (i guess this has to do with JOIN function...)
    SELECT
    T2.[GroupMask] as 'Account Family',
    T2.[FatherNum] as 'Parent Account',
    T2.[AcctCode] AS 'Account Code',
    T2.[AcctName] AS 'Account Name',
    T0.[TaxDate] AS 'Document Date',
    T0.[Number] AS 'Number',
    T0.[DocSeries] AS 'Document Series',
    T0.[BaseRef] AS 'Base Reference',
    T0.[TransId] AS 'Transaction Number',
    T0.[Ref2] AS 'Reference 2',
    T1.[ContraAct] AS 'Offset Account',
    T4.[BaseRef] AS 'PO code',
    T1.[Project] AS 'Project Code',
    T1.[ProfitCode] AS 'Distribution Rule',
    T1.[OcrCode2] AS 'Costing Code 2',
    T1.[OcrCode3] AS 'Costing Code 3',
    T1.[OcrCode4] AS 'Costing Code 4',
    (T1.[SYSdeb]-T1.[SYSCred])  AS 'Total Amount EUR',
    (T1.[FCDebit]- T1.[FCCredit]) AS 'Total Amount (FC)',
    T5.[DocTotalSy] AS 'PO Amount (EUR)'
    FROM  [dbo].[OJDT] T0 
    INNER  JOIN [dbo].[JDT1] T1  ON  T1.[TransId] = T0.[TransId]  
    INNER  JOIN [dbo].[OACT] T2  ON  T2.[AcctCode] = T1.[Account]  AND T2.[AcctCode] = T1.[Account]  
    INNER JOIN [dbo].[OPCH] T3 ON T3.[DocNum] = T0.[BaseRef]
    INNER JOIN [dbo].[PCH1] T4 ON T3.[DocEntry] = T4.[DocEntry]
    LEFT JOIN [dbo].[OPOR] T5 ON T5.[DocNum] = T4.[BaseRef]
    WHERE
    (T2.[AcctCode] > (N'599999' ) ) AND  (T2.[AcctCode] < (N'799999' ) )
    AND (T0.[TaxDate]>= [%0] ) AND (T0.[TaxDate]<= [%1])

    Try This
    SELECT T2.[GroupMask] AS 'Account Family',
       T2.[FatherNum] AS 'Parent Account',
       T2.[AcctCode] AS 'Account Code',
       T2.[AcctName] AS 'Account Name',
       T0.[TaxDate] AS 'Document Date',
       T0.[Number] AS 'Number',
       T0.[DocSeries] AS 'Document Series',
       T0.[BaseRef] AS 'Base Reference',
       T0.[TransId] AS 'Transaction Number',
       T0.[Ref2] AS 'Reference 2',
       T1.[ContraAct] AS 'Offset Account',
       T4.[BaseRef] AS 'PO code',
       T1.[Project] AS 'Project Code',
       T1.[ProfitCode] AS 'Distribution Rule',
       T1.[OcrCode2] AS 'Costing Code 2',
       T1.[OcrCode3] AS 'Costing Code 3',
       T1.[OcrCode4] AS 'Costing Code 4',
       sum(T1.[SYSdeb]-T1.[SYSCred]) AS 'Total Amount EUR',
       sum(T1.[FCDebit]- T1.[FCCredit]) AS 'Total Amount (FC)',
       T6.[DocTotalSy] AS 'PO Amount (EUR)'
    FROM OJDT T0
    INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
    INNER JOIN OACT T2 ON T1.Account = T2.AcctCode
    INNER JOIN OPCH T3 ON T0.TransId = T3.TransId
    INNER JOIN PCH1 T4 ON T3.DocEntry = T4.DocEntry
    INNER JOIN POR1 T5 ON T4.[BaseEntry] = T5.[DocEntry]
    AND T4.[BaseLine] = T5.[LineNum]
    INNER JOIN OPOR T6 ON T5.DocEntry = T6.DocEntry
    GROUP BY T2.[GroupMask],
       T2.[FatherNum],
       T2.[AcctCode],
       T2.[AcctName],
       T0.[TaxDate],
       T0.[Number],
       T0.[DocSeries],
       T0.[BaseRef],
       T0.[TransId],
       T0.[Ref2],
       T1.[ContraAct],
       T4.[BaseRef],
       T1.[Project],
       T1.[ProfitCode],
       T1.[OcrCode2],
       T1.[OcrCode3],
       T1.[OcrCode4],
       T6.[DocTotalSy]
    Regards,
    Kennedy

  • How to find duplicate row in sql query?

    Hi All,
    Please solve my query, find duplicate row and how to count its. your suggestion would be greatly appreciated.

    You can use group by and having.
    SQL> WITH t
      2       AS (SELECT       LEVEL id
      3                 FROM   DUAL
      4           CONNECT BY   LEVEL <= 5
      5           UNION ALL
      6           SELECT       LEVEL + 2
      7                 FROM   DUAL
      8           CONNECT BY   LEVEL <= 3)
      9  SELECT   *
    10    FROM   t;
            ID
             1
             2
             3
             4
             5
             3
             4
             5
    8 rows selected.
    SQL> WITH t
      2       AS (SELECT       LEVEL id
      3                 FROM   DUAL
      4           CONNECT BY   LEVEL <= 5
      5           UNION ALL
      6           SELECT       LEVEL + 2
      7                 FROM   DUAL
      8           CONNECT BY   LEVEL <= 3)
      9  SELECT     id, COUNT (*)
    10      FROM   t
    11  GROUP BY   id
    12    HAVING   COUNT (*) > 1;
            ID   COUNT(*)
             3          2
             4          2
             5          2
    SQL>

  • Duplicate Records in ABAP Query

    I have prepared ABAP query with tables KNA1, KNB1, BSID. I have mapped only BUKRS and KUNNR from BSID . as I don't have any condition to map the fields. I want only one record for considering  KUNNR and BUKRS in report . But in report It is displaying all entries from BSID considering BUKRS and KUNNR means for documents all line items.Kindly suggest as soon. How to avoid such duplicate records

    Hi,
    Duplicate Records in ABAP Query
    Regarding on your problem,
    Use these link, It will helps to your post
    ABAP Querry Duplicate entries
    Regards,
    Sekhar

  • Making abap query on cube

    Hi all,
    I need to find data on a cube loaded in delta mode, but only related to last request...
    It's possible find data in this mode with an abap query?
    tnx

    duccio,
    You can find this only in the change log and you can query RSODSACTREQ for requests and look for the same in the change log.
    In BI3.x atleast you could not query on the change log - this however can be done in BI7 as per my understanding... but definitely worth checking out.
    I will move this to the BI forums - also please be more specific as to what kind of help you would need - the code or the scenario only ?
    Arun

  • ABAP Query  - Duplicates in joins

    Hi All,
    In using joins in ABAP query, I am getting duplicate records in the output. Is there any way to restrict that?
    Please help me with this.
    Thanks in Advance,
    Sushmitha

    Depending on the tables you are using, you may have time-slicing of data where you need to specify the time slice you want to use. 
    In SAP Utilities, when selecting data from tables with time-slicing, we check for a BIS (end) date of 12/31/9999 to denote the most current entry.  Check the tables you are joining and see if any of them indicate they have time-sliced data.  If they do, include a check for the end date in your WHERE conditions.
    K---

  • Identifying and reporting Duplicate rows from table

    I want to fetch all the duplicate row from the table and need to report all of it.
    I am trying to run the below query but and not getting the expected output. Please help me.
    Query
    SELECT * FROM ADDT_RPT_REQ A WHERE
    TRIM(A.EMAIL_ADDR) IN
    (SELECT TRIM(EMAIL_ADDR) FROM ADDT_RPT_REQ B
    WHERE TRIM(B.EMAIL_ADDR) = TRIM(A.EMAIL_ADDR)
    AND A.ph_num IN
    (SELECT PH_NUM FROM ADDT_RPT_REQ B
    WHERE TRIM(A.PH_NUM ) = TRIM(B.PH_NUM)
    There are in all 7 columns in the table where id is Unique Id.
    The expected output is something like.
    FST_NAME     LAST_NAME     EMAIL_ADDR     WORK_PH_NUM     ROW_ID     LAST_UPD     BU_ID
    VALERIE     HALL     [email protected]     7819370177     2-21N-4312     31-AUG-04     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4327     29-JAN-04     0-R9NH
    VALERIE     HALL     [email protected]     6034272034     2-21N-4309     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4317     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     8563748820     2-21N-4329     31-AUG-04     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4319     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4326     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4324     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     8604237395     2-21N-4330     31-AUG-04     0-R9NH
    VALERIE     HALL     [email protected]     7819373731     2-21N-4314     31-AUG-04     0-R9NH
    VALERIE     HALLORAN     [email protected]     6194771101     2-21N-4331     31-OCT-05     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4316     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4321     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     7-1W4N-293     15-MAY-04     0-R9NH
    VALERIE     HALL     [email protected]     2032341604     2-21N-4307     31-AUG-04     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4325     04-APR-03     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     2-21N-4315     29-JAN-03     0-R9NH
    VALERIE     HALL     [email protected]     7819373737     7-1W4N-291     15-MAY-04     0-R9NH
    VALERIE     HALLORAN     [email protected]     6194771101     2-21N-4332     31-OCT-05     0-R9NH
    VALERIE     HALL     [email protected]     6038885349     2-21N-4310     31-AUG-04     0-R9NH
    VALERIE     HALL     [email protected]     7819373737324     2-21N-4328     31-AUG-04     0-R9NH
    VALERIE     HALL     [email protected]     7819370177324     2-21N-4313     31-AUG-04     0-R9NH

    Hi again!
    Try that:
    SELECT rowid, fst_name, last_name, email_addr, work_ph_num, row_id, last_upd, bu_id
    FROM ADDT_RPT_REQ A
    WHERE rowid > (SELECT MIN(rowid)
                   FROM ADDT_RPT_REQ B
                   WHERE B.fst_name = A.fst_name
                     AND B.last_name = A.last_name
                     AND B.email_addr = A.email_addr
                     AND B.work_ph_num = A.work_ph_num
                     AND B.row_id = A.row_id
                     AND B.last_upd = A.last_upd
                     AND B.bu_id = A.bu_id);This query should show you all duplicate rows. Use the rowid and DELETE to get rid of these rows.
    DELETE FROM addt_rpt_req A
    WHERE rowid IN (SELECT rowid
                    FROM   (SELECT rowid, row_number() OVER (PARTITION BY fst_name, last_name, email_addr, work_ph_num, row_id, last_upd, bu_id
                                                             ORDER BY row_id) dup
                            FROM addt_rpt_req)
                            WHERE dup > 1);Yours sincerely
    Florian W.
    Edited by: Florian W. on 17.06.2009 14:17

  • Report Builder 2.0 returning duplicate rows in query designer

    Hi,
    I have a query running off a model, when I explore the data in the model and in a standard sql table it returns one row for each record, which include a unique id for each which is correct.
    When I go into report builder query designer, it shows duplicate rows for each record. I have removed and added fields to try and pin point why and the only reason i can come up with is that it runs fine until I add in a field thats varchar(255) or
    varchar(max). This is when it starts to duplicate the records.
    Can anyone tell me why it does this or point me in the direction of how to stop this. I can't edit the query in text to add DISTINCT so thats not an option.
    Many thanks,
    JJSJ

    OK - I have found a partial answer.   By Googling Report Builder and VARCHAR, I found another post which reported problems with the semantic query builder when the underlying table/view was returning columns of type VARCHAR(MAX).   
    On looking at the length setting for the data column in the DSV,  this reported a length of 2,147,483,647 for this field.   This is very odd because on querying the underlying table the largest length that I can find for this column is 191,086
    (which is far larger than I would have expected - I am investigating this separately).
    However, why should the Report Model think that this field contains such a large value?
    Anyway,  the other post that I found reported that they had solved their problem by converting the field to a VARCHAR (255).    I tried this (by casting the column in my View to VARCHAR(255))  and this resolved the problem
    - no more duplicate rows when adding this field to the query!!!
    I also tried CASTING to TEXT and to VARCHAR(8000).  The former did not resolve the problem; the latter did.
    So I have a workaround but I don't understand why.  
    Can anybody explain why having a VARCHAR(max) column in my entity causes duplicate rows.    
    I suspect it is to do with the fact that for some reason the Report Model seems to think that there is an exceptionally long text string stored in this column in one of the rows but that again is a puzzle.
    Thanks
    Richard

  • ABAP Query Shows duplicate records

    Hi
    I have a ABAP query which links the VIQMEL table(notifcation number) and the VBAK table(order & net value).  The report outputs as:
    Notification A   Order 10   SO value 1000
    Notification B   Order 10   SO value 1000
    Notification C   Order 10   SO value 1000
    Notification D   Order 10   SO value 1000
    The problem is the value is repeated 4 times when we only want it shown the once, is this possible to do and if so how can this be done?
    thanks
    Joe

    Desp09 wrote:
    Hi
    >
    > I have connected
    >
    > EKKO-EBELN to EKPO
    >
    >  EKPO -EBELN and EKPO-EBELP  to the same of EBAN
    >
    > also EKPO-BANFN and EKPO-BNFPO to the same of EBAN
    >
    > EBAN-BANFN and EBAN-BNFPO to VBEP
    >
    > VBEP-VBELN to VBAK-VBELn
    >
    > VBAK-VBELN to VBPA-VBELN
    >
    > VBPA-ADRNR to ADRC-ADDRNUMBER.
    >
    > This is the first time I have created a query so if you can kindly explain the logic of the error it would help in my future reports.
    >
    > Thanks
    > Priya
    Hi Priya,
    You can simplify the process if you make use of the LDB, which will fetch the same report with std LDB available in the system.
    You can define multiple infosets and  pull the fields for easier approach.
    Regards
    Shiva

  • How to delete the duplicate rows present in the parent table & insert the latest duplicate record into the parent table linked with the child table.

    I have a master table and i need to import the rows into the parent and child table.
    Master table name is Flatfile_Inventory
    Parent Table name is INVENTORY
    Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
    Error details will be goes to LOG_INVENTORY_ERROR
    I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.
    Again when i run the query using stored procedure,
    its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.
    I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i
    must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.
    Please help me to write the query i have attached the Full stored procedure Script..
    Arunraj Kumar

    Hi Santhosh,
    This is my Script.
    -- =============================================
    -- Stored Procedure for FLATFILE_INVENTORY
    -- =============================================
    -- Drop stored procedure if it already exists
       DROP PROCEDURE SP_Flatfile_Inventory
    GO
    CREATE PROCEDURE SP_Flatfile_Inventory
    AS
    --USE IconicMarketing
    GO
    DECLARE
    @FileType  varchar(50)  ,
    @ACDealerID  varchar(50)  ,
    @ClientDealerID  varchar(50)  ,
    @DMSType  varchar(50)  ,
    @StockNumber  varchar(50)  ,
    @InventoryDate  datetime  ,
    @StockType  varchar(100)  ,
    @DMSStatus  varchar(50)  ,
    @InvoicePrice  numeric(18, 2)  ,
    @CostPack  varchar(50)  ,
    @SalesCost  numeric(18, 2)  ,
    @HoldbackAmount  numeric(18, 2)  ,
    @ListPrice  numeric(18, 2)  ,
    @MSRP  varchar(max)  ,
    @LotLocation  varchar(50)  ,
    @TagLine  varchar(max)  ,
    @Certification  varchar(max)  ,
    @CertificationNumber  varchar(max)  ,
    @VehicleVIN  varchar(50)  ,
    @VehicleYear  bigint  ,
    @VehicleMake  varchar(50)  ,
    @VehicleModel  varchar(50)  ,
    @VehicleModelCode  varchar(50)  ,
    @VehicleTrim  varchar(50)  ,
    @VehicleSubTrimLevel  varchar(max)  ,
    @Classification  varchar(max)  ,
    @TypeCode  varchar(100)  ,
    @VehicleMileage  bigint  ,
    @EngineCylinderCount  bigint  ,
    @TransmissionType  varchar(50)  ,
    @VehicleExteriorColor  varchar(50)  ,
    @VehicleInteriorColor  varchar(50)  ,
    @CreatedDate  datetime  ,
    @LastModifiedDate  datetime  ,
    @ModifiedFlag  varchar(max)  ,
    @InteriorColorCode  varchar(50)  ,
    @ExteriorColorCode  varchar(50)  ,
    @PackageCode  varchar(50)  ,
    @CodedCost  varchar(50)  ,
    @Air  varchar(100)  ,
    @OrderType  varchar(max)  ,
    @AgeDays  bigint  ,
    @OutstandingRO  varchar(50)  ,
    @DlrAccessoryRetail  varchar(50)  ,
    @DlrAccessoryCost  varchar(max)  ,
    @DlrAccessoryDesc  varchar(max)  ,
    @ModelDesc  varchar(50)  ,
    @Memo1  varchar(1000)  ,
    @Memo2  varchar(max)  ,
    @Weight  varchar(max)  ,
    @FloorPlan  numeric(18, 2)  ,
    @Purchaser  varchar(max)  ,
    @PurchasedFrom  varchar(max)  ,
    @InternetPrice  varchar(50)  ,
    @InventoryAcctDollar  numeric(18, 2)  ,
    @VehicleType  varchar(50)  ,
    @DealerAccessoryCode  varchar(50)  ,
    @AllInventoryAcctDollar  numeric(18, 2)  ,
    @BestPrice  varchar(50)  ,
    @InStock  bigint  ,
    @AccountingMake  varchar(50)  ,
    @GasDiesel  varchar(max)  ,
    @BookValue  varchar(10)  ,
    @FactoryAccessoryDescription  varchar(max)  ,
    @TotalReturn  varchar(10)  ,
    @TotalCost  varchar(10)  ,
    @SS  varchar(max)  ,
    @VehicleBody  varchar(max)  ,
    @StandardEquipment  varchar(max)  ,
    @Account  varchar(max)  ,
    @CalculatedPrice  varchar(10)  ,
    @OriginalCost  varchar(10)  ,
    @AccessoryCore  varchar(10)  ,
    @OtherDollar  varchar(10)  ,
    @PrimaryBookValue  varchar(10)  ,
    @AmountDue  varchar(10)  ,
    @LicenseFee  varchar(10)  ,
    @ICompany  varchar(max)  ,
    @InvenAcct  varchar(max)  ,
    @Field23  varchar(max)  ,
    @Field24  varchar(max)  ,
    @SalesCode  varchar(max)  ,
    @BaseRetail  varchar(10)  ,
    @BaseInvAmt  varchar(10)  ,
    @CommPrice  varchar(10)  ,
    @Price1  varchar(10)  ,
    @Price2  varchar(10)  ,
    @StickerPrice  varchar(10)  ,
    @TotInvAmt  varchar(10)  ,
    @OptRetail  varchar(max)  ,
    @OptInvAmt  varchar(10)  ,
    @OptCost  varchar(10)  ,
    @Options  varchar(max)  ,
    @Category  varchar(max)  ,
    @Description  varchar(max)  ,
    @Engine  varchar(max)  ,
    @ModelType  varchar(max)  ,
    @FTCode  varchar(max)  ,
    @Wholesale  varchar(max)  ,
    @Retail  varchar(max)  ,
    @Draft  varchar(max)  ,
    @Inventoryid int;
    DECLARE Inventory_Cursor CURSOR FOR 
    SELECT * from [dbo].[FLATFILE_INVENTORY];
    OPEN Inventory_Cursor
    FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    WHILE @@FETCH_STATUS = 0
    BEGIN
        PRINT @VehicleVIN    ;
    -- ****************** insert into Inventory Table ***********
    INSERT INTO INVENTORY 
    IconicDealerID,
    StockNumber,
    DMSType,
    InventoryDate
    VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate);
    set @Inventoryid = scope_identity();
    PRINT @Inventoryid;
    --Insert into Inventory_Details Table
    INSERT INTO [INVENTORY_DETAILS]
    InventoryID,
    StockType,
    DMSStatus,
    LotLocation,
    TagLine,
    Certification,
    CertificationNumber,
    CreatedDate,
    LastModifiedDate,
    ModifiedFlag,
    PackageCode,
    OrderType,
    AgeDays,
    OutstandingRO,
    Memo1,
    Memo2,
    Purchaser,
    PurchasedFrom,
    DealerAccessoryCode,
    InStock,
    AccountingMake,
    SS,
    Account,
    AccessoryCore,
    ICompany,
    InvenAcct,
    Field23,
    Field24,
    SalesCode,
    Draft,
    FTCode
    VALUES (
    @InventoryID,
    @StockType,
    @DMSStatus,
    @LotLocation,
    @TagLine,
    @Certification,
    @CertificationNumber,
    @CreatedDate,
    @LastModifiedDate,
    @ModifiedFlag,
    @PackageCode,
    @OrderType,
    @AgeDays,
    @OutstandingRO,
    @Memo1,
    @Memo2,
    @Purchaser,
    @PurchasedFrom,
    @DealerAccessoryCode,
    @InStock,
    @AccountingMake,
    @SS,
    @Account,
    @AccessoryCore,
    @ICompany,
    @InvenAcct,
    @Field23,
    @Field24,
    @SalesCode,
    @Draft,
    @FTCode
    --Insert into Inventory_Amount Table
    INSERT INTO [dbo].[INVENTORY_AMOUNT]
    InventoryID,
    AllInventoryAcctDollar,
    OtherDollar,
    PrimaryBookValue,
    AmountDue,
    LicenseFee,
    CalculatedPrice,
    OriginalCost,
    BookValue,
    TotalReturn,
    TotalCost,
    DlrAccessoryRetail,
    DlrAccessoryCost,
    DlrAccessoryDesc,
    InternetPrice,
    InventoryAcctDollar,
    BestPrice,
    Weight,
    FloorPlan,
    CodedCost,
    InvoicePrice,
    CostPack,
    SalesCost,
    HoldbackAmount,
    ListPrice,
    MSRP,
    BaseRetail,
    BaseInvAmt,
    CommPrice,
    Price1,
    Price2,
    StickerPrice,
    TotInvAmt,
    OptRetail,
    OptInvAmt,
    OptCost,
    Wholesale,
    Retail
    VALUES (
    @InventoryID,
    @AllInventoryAcctDollar,
    @OtherDollar,
    @PrimaryBookValue,
    @AmountDue,
    @LicenseFee,
    @CalculatedPrice,
    @OriginalCost,
    @BookValue,
    @TotalReturn,
    @TotalCost,
    @DlrAccessoryRetail,
    @DlrAccessoryCost,
    @DlrAccessoryDesc,
    @InternetPrice,
    @InventoryAcctDollar,
    @BestPrice,
    @Weight,
    @FloorPlan,
    @CodedCost,
    @InvoicePrice,
    @CostPack,
    @SalesCost,
    @HoldbackAmount,
    @ListPrice,
    @MSRP,
    @BaseRetail,
    @BaseInvAmt,
    @CommPrice,
    @Price1,
    @Price2,
    @StickerPrice,
    @TotInvAmt,
    @OptRetail,
    @OptInvAmt,
    @OptCost,
    @Wholesale,
    @Retail
    --Insert into Inventory_Vehicle Table
    INSERT INTO [dbo].[INVENTORY_VEHICLE]
    InventoryID,
    InteriorColorCode,
    ExteriorColorCode,
    Air,
    ModelDesc,
    VehicleType,
    VehicleVIN,
    VehicleYear,
    VehicleMake,
    VehicleModel,
    VehicleModelCode,
    VehicleTrim,
    VehicleSubTrimLevel,
    Classification,
    TypeCode,
    VehicleMileage
    VALUES (
    @InventoryID,
    @InteriorColorCode,
    @ExteriorColorCode,
    @Air,
    @ModelDesc,
    @VehicleType,
    @VehicleVIN,
    @VehicleYear,
    @VehicleMake,
    @VehicleModel,
    @VehicleModelCode,
    @VehicleTrim,
    @VehicleSubTrimLevel,
    @Classification,
    @TypeCode,
    @VehicleMileage
    -- Move cursor to Next record 
        FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    END 
    CLOSE Inventory_Cursor;
    DEALLOCATE Inventory_Cursor;
    GO
    SET ANSI_PADDING OFF
    GO
    Arunraj Kumar

Maybe you are looking for

  • Spry drop down works in IE but not in FireFox or Chrome. Why?

    I have used the standard spry drop down on several other sites with great success and no browser compatibility issues. I think what's happened is that I messed up my Spry Assets when I was tweaking things so now I can't get it to work the way it did

  • ITS templates are not correctly loaded.

    Dear everyone, I am have a problem in installing ITS IAC template to ITS 4.6(it's old..) We are using EBP 2.0C and I newly installed ITS 4.6 and published all the necessary HTML templates. However, when I access to BBPSTART, it does not load expected

  • What was wrong with OS 10.5 airport settings

    I'm wondering what was specifically wrong with the networking built into 10.5. I noticed that one of the fixes says "Improves compatibility with third-party wireless wide-area network devices". What compatability issues did they resolve?

  • How to access streaming vedio from server using RMI

    Hello please provide me the solution i have one vedio file in remote system and i want to import it to my local system using RMI after that i have to control it like vedio player.This entire application should be developed in struts. please give me a

  • Running on separate machines

    Hi. I have an RMI enabled program that communicates fine with each other on the same machine but when I try and run the server on one computer and then call the method from another the whole thing falls to pieces and I can't figure out why! I have 3