With temp tables it does not seem to work:
create table tblData (DataValue varchar(30))
create table tblLog (LogValue varchar(30))
drop table ##tbllog
create table ##tblLog (LogValue varchar(30))
begin transaction
insert into tblData (DataValue) VALUES ('Value 1')
insert into ##tblLog (LogValue) VALUES ('Value 1 logged')
insert into tblData (DataValue) VALUES ('Value 2')
insert into ##tblLog (LogValue) VALUES ('Value 2 logged')
rollback
select * from tblData
select * from ##tblLog
Main Topics
Browse All Topics





by: adwisemanPosted on 2006-03-17 at 06:00:29ID: 16215754
Write the logging to a temp table or a table variable, then right after you rollback the transaction, write the records to the permanant table.