• arunnrj87 (11/17/2014)


    Hi Friends I am Using the Below mentioned Script to fetch the data from Flatfile table and i need to populate it into respective Parent and Child table by Cursur.

    In between the Scripts i am calling the Error Log Table by using the Path from the local folder where the Error Log table script is available.

    Now i need to run this through Stored Procedure.

    Please guide me how to create Stored Procedure and how to load datas into Flatfile table and from Flatfile Table to Parent and Child Table.

    I can help guide you but you may not like what I have to say. You need to rebuild this whole concept and get rid of that cursor. There is simply no need to use a cursor here at all. You have a few delete statements followed by some inserts. You can use OUTPUT and MERGE to help.

    I can help you with the code but in order to offer any real help we need a few things:

    1. Sample DDL in the form of CREATE TABLE statements.

    2. Sample data in the form of INSERT INTO statements.

    3. Expected results based on the sample data.

    Please take a few minutes and read the first article in my signature for best practices when posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/