[dba-SQLServer] Transactions

Francisco Tapia fhtapia at gmail.com
Tue Oct 6 16:59:10 CDT 2009


One minor change, (see below)
also follow this link
http://msdn.microsoft.com/en-us/library/aa175920%28SQL.80%29.aspx

-Francisco
http://sqlthis.blogspot.com | Tsql and More...


On Tue, Oct 6, 2009 at 2:51 PM, David McAfee <davidmcafee at gmail.com> wrote:

> BEGIN TRAN JC1
>
> SELECT Something
>
> INSERT INTO TABLE tblSomeTable
> SELECT SOMETHING
>
> UPDATE tblSomewthing SET Something = SOmethingElse
>
> IF @@ERROR <> 0
>
 BEGIN

> ROLLBACK TRAN JC1
>
  END
ELSE
 BEGIN
  COMMIT TRAN JC1
 END

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