Process row by row in SQL Server

  • In SQL Server, Currrently i having an SSIS

    1. Query bulk records from relevant tables.
    2. To loop through each row in SSIS package
    3. Call relevant Stored Procedure.
    4. Each row containing calculation which is required to refer to previous row

     

    May i know beside of above mechanism, any other alternative technology

     

  • Without seeing the code, it's hard to know for sure if this is the best way to get things done. It is possible within T-SQL to reference a data set where by you order the data and then refer to previous rows as part of a calculation. I would not say it's always best to put things into a single T-SQL statement. However, frequently, if you can turn your operations into a single set-based command, it has enormous benefits. Here is a very rough example of that kind of processing.

    That's about all I can suggest based on the information at hand. I'm not saying you should change things, but there are a number of ways to get around this sort of functionality. The devil is in the details.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply