Francisco Tapia
fhtapia at gmail.com
Fri Jul 27 09:00:03 CDT 2012
Hey Dav! good call on the raise error, I think the raise error will be even more significant for John who wants to just know if the process succeeded or failed (and if failed for what reason). -Francisco -------------------------- You should follow me on twitter here: http://twitter.com/fhtapia http://bit.ly/sqlthis | http://bit.ly/xcodethis | SQL | XCode and ... <http://db.tt/JeXURAx> On Fri, Jul 27, 2012 at 6:48 AM, David McAfee <davidmcafee at gmail.com> wrote: > It's acceptable. > > I also do it like Francisco showed. > > When i rollback i like to raise an error so the front end knows it was > rolled back and your error trapping can catch it and handle it gracefully. > > Something like: raiserror('somethingHappened',17,1) > > Sent from my Droid phone. > On Jul 27, 2012 5:37 AM, "jwcolby" <jwcolby at colbyconsulting.com> wrote: > > > Is Tran an acceptable abbreviation or was that just an aircode thing? > > > > John W. Colby > > Colby Consulting > > > > Reality is what refuses to go away > > when you do not believe in it > > > > On 7/27/2012 8:03 AM, Francisco Tapia wrote: > > > >> I like to name my transactions > >> So when I write it I do it like this: > >> > >> Begin Tran t1 > >>> Do stuff > >>> Do more stuff > >>> > >> If some stuff begin > >> > >>> Commit Tran t1 > >>> > >> End > >> Else begin > >> Rollback tran t1 > >> End > >> > >> In this way I know that what I've wrapped up is actually committed (or > >> rolled back when some criteria is not met.) > >> > >> > >> > >> Sent from my mobile device > >> > >> On Jul 27, 2012, at 4:26 AM, jwcolby <jwcolby at colbyconsulting.com> > wrote: > >> > >> SQL Server appears to be hanging for a batch job. I am wrapping a > group > >>> of processes in a transaction. It processes dozens of these things > then... > >>> suddenly it stops. I cannot get it to start again. If i exit SSMS it > pops > >>> up a message: > >>> > >>> "there are uncommitted transactions. Do you wish to commit these > >>> transactions before closing the window?" > >>> > >>> I say yes, it performs a commit, and I can go right back in to SSMS and > >>> start up this process and it takes off and runs. > >>> > >>> So what is SSMS doing to commit these "uncommitted transactions"? And > >>> can I do that same thing in TSQL? > >>> > >>> I wrap the transaction group in a > >>> > >>> Begin Transaction > >>> Do stuff > >>> Do more stuff > >>> Commit > >>> > >>> What more is there? > >>> > >>> -- > >>> John W. Colby > >>> Colby Consulting > >>> > >>> Reality is what refuses to go away > >>> when you do not believe in it > >>> > >>> ____________________ > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >