Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Replication (2005)
 @pre_snapshot_script

Author  Topic 

buraktuf
Starting Member

13 Posts

Posted - 2008-11-29 : 02:59:13
Hello,
I've got a problem with merge replication such a foreign key constraint. Bu as i researched the solution of my problem is setting the pre_snaphot_script parameter. but i cant find how it works and how should it be set. can anybody help me by giving some information and some basic examples if available about this script? Or you can give me a link of a document about this script which should i read, if you can find any.
Thanks for any reply.

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-11-29 : 05:33:20
On SQL 2005 you find that by going into the properties of the publication and selecting (I think) the snapshot page. There's space to specify a T-SQL script file to be run before the snapshot applies and a script to be run afterwards.

As for documentation, have you tried Book Online?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

buraktuf
Starting Member

13 Posts

Posted - 2008-11-29 : 06:08:03
Thanks for your interest.
I tried BOL but there is a short explanation in BOL. I want to write a script that drops the foreign key relations on the subscriber site before a snapshot process and also i want to write a post_snapshot_script that gets the relations back after the snapshot is gone to the subscriber site. In this way i think that i will not get during the snaphot in the merge replication "The object X could not be dropped because it is referenced by a FOREIGN KEY constraint" which is my main problem as i mentioned. Can you help me further in this way? thanks again.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-11-29 : 12:08:32
Write the script that does what you want and include is as a pre/post snapshot script. There's nothing more to it than that.
So, write a script that drops the keys, save it as a file and link that in as the pre-snapshot script. Write a similar one that puts the constraits back, save it and put it as the post snapshot script



--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -