[dba-SQLServer] Transactions

David McAfee davidmcafee at gmail.com
Tue Oct 6 16:51:10 CDT 2009


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
>
>




More information about the dba-SQLServer mailing list