TSQL Commit Rows

  • Has anyone ever figured out a way to commit a certain number of rows in a select statement.

    I always thought the general rule is that if you can check a box in ssis, there is equitable functionality in Tsql.

    I am having a hard time believing that you can't.

  • A SELECT statement would have nothing to commit. What are you trying to do?

  • I guess I was pretty unclear.

    I am currently using SSIS data flow task to select and insert rows from one table to another.

    There is a check box to commit after a certain number of rows.

    I would like to stop using SSIS and do it in tsql.

    I was wondering if there is any way to programmatically commit a certain number of rows.

    Thanks,

  • stevoid1970 (12/15/2008)


    I guess I was pretty unclear.

    I am currently using SSIS data flow task to select and insert rows from one table to another.

    There is a check box to commit after a certain number of rows.

    I would like to stop using SSIS and do it in tsql.

    I was wondering if there is any way to programmatically commit a certain number of rows.

    Thanks,

    In T-SQL you would use the TOP (N) predicate to do that. In the current versions (2005/2008) you can also use SET ROWCOUNT N, but that will stop working with anything updating tables in the next version.

    Keep in mind that by doing that - you need to a. structure your statement to "walk through the table" and b. reissue the command enough times to walk all of the way through the table.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Right, search the site a bit for batch large transactions. There are some posts and articles about doing this that will help you write the necessary loops.

Viewing 5 posts - 1 through 4 (of 4 total)

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