Home Forums SQL Server 2008 SQL Server 2008 - General Use of cursor in ETL stored procedure for moving data from one table to many tables RE: Use of cursor in ETL stored procedure for moving data from one table to many tables

  • Hi rhythmk,

    Thanks for the response.

    Yes. For validations I am using primary key. If the row with that primary key exist in table 1, I need to reject that record and add that record to 'reject' table.

    If the row does not exists, then add the record in the table 1.

    Again I need to refer to table 1 and create child record in other tables ( 8 tables). Basically I am splitting one master source table into many destination tables based on PK/FK relationships. An ETL process.

    One more point is : I need to generate primary key in all the destination tables manually taking max of current value and incrementing it by 1.

    Implementing this logic in other languages like C is easy. In SQL, adding all conditions in stored procedure without cursor seems to be difficult.

    I am thinking cursor will give me that advantage of applying logic to one row at a time.

    Attached in file is the requirement description. Hope it helps!

    Thanks,

    Somanath