Error returned when trying to commit the transaction to a database that is a replication distributor. (sql2005 ctp16)
the error I am seeing:
Msg 627, Level 16, State 0, Procedure sp_MSmerge_altertable, Line 305
Cannot use SAVE TRANSACTION within a distributed transaction.
Anyone encounter transaction problem with replication
Thanks.

sql2005:Cannot use SAVE TRANSACTION within a distributed transaction
Tim Brassey
javamick, i could not reproduce your problem, maybe it's something else. This works fine when remote proc trans is enabled or disabled:
create table t1 (col1 int)
go
create trigger trig1 on t1 for update
as
declare @x sysname
set @x = 'test1_' + cast(getdate() as varchar(20))
EXEC msdb.dbo.sp_add_job @job_name = @x
go
insert into t1 values (1)
go
update t1 set col1 = 2
go
Is replication involved in this problem
Sonic_Molson
sp_add_jobstep
sp_add_jobserver
sp_start_job
I'll try to work up some demo code in just a sec, but if this helps answer it, let me know.
Thanks,
Micky
ChandraSiva
exec sp_configure 'show advanced' ,1
go
reconfigure with override
go
exec sp_configure
go
If so do you know why it is enabled and is it possible to turn this off
To turn it off
exec sp_configure 'remote proc trans',0
go
reconfigure with override
jorrit5477
CREATE TABLE t1 (col1 int)
go
CREATE TRIGGER trig1 ON t1 FOR UPDATE
AS
DECLARE @x AS sysname
DECLARE @jobid varchar(38)
DECLARE @jobname sysname
DECLARE @GUID varchar(38)
DECLARE @stepname sysname
DECLARE @sCommand nvarchar(200)
IF UPDATE(col1)
BEGIN
SET @jobid = NULL
SET @GUID = NEWID()
SET @stepname = 'test step 1'
SET @jobname = CAST('test' + @GUID AS sysname)
SET @sCommand = 'SELECT TOP 1 * FROM t1'
EXEC msdb.dbo.sp_add_job @job_name = @jobname
, @enabled = 1
, @description = ''
, @owner_login_name = NULL
, @notify_level_eventlog = 2
, @delete_level = 1
, @job_id = @jobid OUTPUT
EXEC msdb.dbo.sp_add_jobstep @job_id = @jobid
, @step_name = @stepname
, @subsystem = 'TSQL'
, @command = @sCommand
, @on_success_action = 1
, @on_fail_action = 2
, @database_name = 'Playground'
, @database_user_name = NULL
, @retry_attempts = 3
, @retry_interval = 1
EXEC msdb.dbo.sp_add_jobserver @job_id = @jobid, @server_name = NULL
EXEC msdb.dbo.sp_start_job @job_id = @jobid
END
GO
insert into t1 values (1)
go
update t1 set col1 = 2
go
Any ideas
Thanks,
Micky
PitBull.ja
If it is something that should be corrected in SQL Server, where can I submit it
Thanks,
Micky
BTW, here is the link to the newsgroup post:
http://groups.google.com/group/microsoft.public.sqlserver.server/browse_thread/thread/b4882e6ffd004b25/
I hope I did the link right. The subject is "SQL 2005: Error with Trigger"
JodyByrd
Hi Micky, thanks for your post, just wanted to let you know that your specific issue is actually a known issue in SQL 2005, and is slated to be fixed in the next release of SQL Server. I'll raise awareness internally about this and point them to your post, but I can't guarantee you anything will be done for SQL 2005.
DaFeiFan
http://lab.msdn.microsoft.com/ProductFeedback/ViewWorkaround.aspx FeedbackID=FDBK42832#1
Thanks,
Micky
MARK E6581
Any ideas
Thanks,
Micky
sjoshi
The problem is now solved.
The stored procedure that was entering data was altering the table as part of the transaction. (Dropping the primary key before insert and returning it after...)
This isn't possible if the table is meant for replication