SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Editing replication stored procedures


Editing replication stored procedures

Author
Message
david.alcock
david.alcock
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1205 Visits: 1204
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'
Sean Lange
Sean Lange
SSC Guru
SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)

Group: General Forum Members
Points: 58883 Visits: 17938
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 Modens 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)
happycat59
happycat59
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8261 Visits: 3281
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.



david.alcock
david.alcock
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1205 Visits: 1204
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'
ian.hewitt 52640
ian.hewitt 52640
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 16
If you were to use the standard MS Stored Procs? At what point would they get overwritten? Setting up replication again?
Sean Lange
Sean Lange
SSC Guru
SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)SSC Guru (58K reputation)

Group: General Forum Members
Points: 58883 Visits: 17938
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 Modens 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)
ian.hewitt 52640
ian.hewitt 52640
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 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!?
david.alcock
david.alcock
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1205 Visits: 1204
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'
ian.hewitt 52640
ian.hewitt 52640
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 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!
david.alcock
david.alcock
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1205 Visits: 1204
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'
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search