Unix Technical Forum

Instead of Delete in replication

This is a discussion on Instead of Delete in replication within the SQL Server forums, part of the Microsoft SQL Server category; --> I am looking into work-arounds for what seems to be a flaw, or "undocumented feature" of SQL Server replication ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 05:12 AM
cfxchange
 
Posts: n/a
Default Instead of Delete in replication

I am looking into work-arounds for what seems to be a flaw, or
"undocumented feature" of SQL Server replication and Instead of Delete
triggers not playing together. It seems that if you want to use
replication then you cannot use Instead Of triggers as it prohibits the
replication triggers from firing. My delima is that I need to cascade
delete, but first have the record and all child records inserted into
associated delete tables (<tablename>_del). This worked well using
Instead of delete triggers, but now we are moving to a replication
environment and it does not synchronize deletes to the publisher or
subscriber.

The options I am looking into and the stumbling points they introduce
are:

1. Not using Instead Of triggers, but using After to insert the
deleted record into a <tablename>_del table (where of course
<tablename> is the actual table name). The triggers are designed to
cascade delete all related child records. The problem with this
option is that there are relationship constraints that cause the
delete to raise an error complaining about these constraints. Of
course the child records need to be deleted first, but since this
runs after the delete I cannot perform this cascade delete via
trigger (or can I?).

2. Same as above only using SQL Server 2k's "Cascade Delete"
option. My question on this is, will the cascade delete execute the
After Delete triggers for each child table in the relationship? If
not, is there a way to move these deleted records into
<tablename>_del before they are deleted, keeping in mind that it
must be compatible with merge replication.

3. Not yet found any information on this, but is it possible to
manually include information to be replicated after the "Instead Of"
triggers so that the changes are included in the replication?
I really appreciate the advice.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 05:13 AM
cfxchange
 
Posts: n/a
Default Re: Instead of Delete in replication

I'm loosing hope. Can anyone point me in the right direction here? Is
there a way to either mimic an Instead of Delete trigger or to manually
add records to the MSmerge_tombstone table after a Instead Of Delete
trigger is run?

Please, any advice is appreciated.

-Thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 05:13 AM
cfxchange
 
Posts: n/a
Default Re: Instead of Delete in replication

I'm loosing hope. Can anyone point me in the right direction here? Is
there a way to either mimic an Instead of Delete trigger or to manually
add records to the MSmerge_tombstone table after a Instead Of Delete
trigger is run?

Please, any advice is appreciated.

-Thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 05:14 AM
Erland Sommarskog
 
Posts: n/a
Default Re: Instead of Delete in replication

cfxchange (aadams@cfxchange.com) writes:
> I'm loosing hope. Can anyone point me in the right direction here? Is
> there a way to either mimic an Instead of Delete trigger or to manually
> add records to the MSmerge_tombstone table after a Instead Of Delete
> trigger is run?
>
> Please, any advice is appreciated.


The only advice I have is to try microsoft.public.sqlserver.replication at
msnews.microsoft.com.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com