July 23, 2009 at 7:19 am
I executed a script with many commits in in. However, while executing the script together i got a message
"The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION"
Does that mean the all the SQL statenments after the COMMIT (keyword triggering the message)
was not executed?
July 23, 2009 at 11:36 am
I just tried this bit of code, both select statements run, and it gave me the same error as well. So I imagine that whatever you had after the statement did run.
--begin tran
select 2
commit
select 1
July 24, 2009 at 2:22 am
How about creating or modifying objects and putting the commit in between?
July 24, 2009 at 8:34 am
if object_id('tempdb..#totest')is not null drop table #totest
create table #totest(
clm1 int
)
insert #totest values ('5')
--begin tran
select * from #totest
commit
alter table #totest
add clm2 char(1)
select * from #totest
July 24, 2009 at 9:04 am
does that mean that the message is just an information and the whole code will execute anyway?
July 24, 2009 at 9:20 am
It would appear so, at least based on the two situations you asked about so far. If you are curious regarding transactions in general then I would suggest some web searches.
A little light reading that I found informative:
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply