Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Editing replication stored procedures Expand / Collapse
Author
Message
Posted Monday, February 4, 2013 2:33 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 3:02 AM
Points: 211, Visits: 842

Just wanted a high level answer really on whether or not it is a good idea to alter the sql replication stored procedures.

Reason I ask is that we have a need for replication but the destination table has many additional columns to the source and a proposed solution is to set up transactional replication but customise the sprocs to retrieve additional information.

I have to admit I dont particulalry like the idea but I might be being a little too cautious, is it a reasonable solution to consider?


'Only he who wanders finds new paths'
Post #1415194
Posted Monday, February 4, 2013 7:57 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:21 PM
Points: 13,083, Visits: 11,918
david.alcock (2/4/2013)

Just wanted a high level answer really on whether or not it is a good idea to alter the sql replication stored procedures.

Reason I ask is that we have a need for replication but the destination table has many additional columns to the source and a proposed solution is to set up transactional replication but customise the sprocs to retrieve additional information.

I have to admit I dont particulalry like the idea but I might be being a little too cautious, is it a reasonable solution to consider?


Don't do it!!! What happens when the next update gets released and overwrites your changes? It is generally a very bad idea to alter the MS stored procs.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1415318
Posted Monday, February 4, 2013 8:10 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 10:16 PM
Points: 2,922, Visits: 2,521
You can create your own sprocs for use by replication. Have a look at what the MS generated sprocs do (and in particular, the parameter) and then use that as the basis for your own, which you would code to lookup the extra values etc.

When you create the article(s) in the publication, just specify you custom sprocs and away you go. You will need to make sure that that exist - either create them directly or add them in a script that is run by replication when the subscription is established. I suspect that, since you have table definitions at your subscriber that are different from your published, it would probably easier for you to create the sprocs in advance.



Post #1415556
Posted Tuesday, February 5, 2013 2:41 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 3:02 AM
Points: 211, Visits: 842
Thank you both for the replies.

Certainly altering the system sprocs are a no no, it did sound fundamentally...well wrong to me! Alternatively, having customised scripts does sound interesting. I just wonder if its more straightforward to allow replication to continue then use SSIS to perform any necessary transformations.


'Only he who wanders finds new paths'
Post #1415663
Posted Tuesday, February 5, 2013 4:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 19, 2013 5:59 AM
Points: 3, Visits: 16
If you were to use the standard MS Stored Procs? At what point would they get overwritten? Setting up replication again?
Post #1415713
Posted Tuesday, February 5, 2013 7:21 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:21 PM
Points: 13,083, Visits: 11,918
ian.hewitt 52640 (2/5/2013)
If you were to use the standard MS Stored Procs? At what point would they get overwritten? Setting up replication again?


They have the potential of being overwritten when you update sql server. Service packs, etc. The real problem is that by the time the next service pack is release you forget that you changed those sprocs and everything comes crashing down until you figure out what the changes you need to make are now when sproc you changed is different. Another very real possibility is that you are at another job and nobody knows what the change was or why it was made.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1415829
Posted Tuesday, February 5, 2013 7:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 19, 2013 5:59 AM
Points: 3, Visits: 16
I see your point around the risk, but ....Should a service pack over write stored procedures that are created for a specific subscriber? I can't see why they would...!?

I believe the real question here is wether SQL Replication is a suitable "engine level" technology to use when syncronising from a database where the tables and associated columns don't exactly match the subscribing database structure!?

Would you suggest using "custom" stored procedures, if they MS ones could disappear?, to overcome the problem and, in effect, filter the data (reduce columns) from the publishing DB to the subscriber DB. Surely custom sprocs would be "safer"!?

Also having a proper package release process would over come problems when installing service packs as you would have the correct package to "re-install" any customisation!?
Post #1415847
Posted Tuesday, February 5, 2013 8:23 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 3:02 AM
Points: 211, Visits: 842
The one argument I have against this is that the more customisation that going into these stored procedures surely increases the possibility of failure. In my opinion the high availability of data that you gain from using replication is comprimised greatly. Surely if a high amount of customisation is required then replication might not be the ideal solution in the first place?

Again, maybe I am being over cautious but I would rather manipulate data than manipulate system generated objects?


'Only he who wanders finds new paths'
Post #1415883
Posted Tuesday, February 5, 2013 9:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 19, 2013 5:59 AM
Points: 3, Visits: 16
I can't believe that Microsoft have a section (with replication setup) that specifically allows you to provide customised stored procedures as part of the replication engine!!! If they didn't want you messing with it why would they provide a mechanism to change it?

I don't mean to be argumentative but I can't believe someome out there hasn't achieved this type of replication!!!!!?????

Maybe tech people have lost the true, can do spirit amidst all the setup wizards!
Post #1415930
Posted Tuesday, February 5, 2013 10:15 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 3:02 AM
Points: 211, Visits: 842
Microsoft allows auto shrink and auto growth at the same time in SQL, it certainly doesnt mean its a wise decision to actually do it

'Only he who wanders finds new paths'
Post #1415977
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse