[dba-SQLServer] Transactions

jwcolby jwcolby at colbyconsulting.com
Tue Oct 6 19:39:12 CDT 2009


No David, this is manually breaking the insert down into X separate insert queries, then wrapping 
each in a transaction.  I am talking about a SINGLE insert or a SINGLE Update SQL Statement where 50 
million records are going to be inserted or updated, but where SQL Server stops every 10 million 
records and performs the insert or update for the first 10 million records, then again 10 million 
records later etc.

John W. Colby
www.ColbyConsulting.com


David McAfee wrote:
> BEGIN TRAN JC1
> 
> SELECT Something
> 
> INSERT INTO TABLE tblSomeTable
> SELECT SOMETHING
> 
> UPDATE tblSomewthing SET Something = SOmethingElse
> 
> 
> ROLLBACK TRAN JC1
> --If everything works as expected, comment above line and uncomment next line
> --COMMIT TRAN JC1
> 
> On Tue, Oct 6, 2009 at 2:34 PM, jwcolby <jwcolby at colbyconsulting.com> wrote:
>> Is it possible to tell SQL Server to use transactions inside of a single query?
>>
>> I routinely do things like update a single field for 50 million records.  It might be beneficial to
>> be able to tell SQL Server to commit the updates every N million records.  I have no idea whether it
>> is possible, or if it is what the results would be but I thought it worth asking the question.
>>
>> Can it be done?  Would it make any difference.
>>
>> --
>> John W. Colby
>> www.ColbyConsulting.com
>> _______________________________________________
>> dba-SQLServer mailing list
>> dba-SQLServer at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>> http://www.databaseadvisors.com
>>
>>
> 
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 
> 



More information about the dba-SQLServer mailing list