Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sql server replication

Posted on 2012-03-29
3
Medium Priority
?
245 Views
Last Modified: 2012-06-21
I want some way of doing replication in which only inserted and updated data gets replicated not the deleted one.

The idea is to build archiving database from the live db. but we want live db to be small.

1- Move changed data from live db to archive db
2- delete data from live db of older than today

we have to implement this in sql server. any other solution than replication.
0
Comment
Question by:Epurchase
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
lojk earned 100 total points
ID: 37782264
Your best option is to use triggers added to your tables.

http://msdn.microsoft.com/en-us/library/ms189799.aspx

also

http://msdn.microsoft.com/en-us/magazine/cc164047.aspx

After each 'Insert/Update' trigger you coudl write to another table in another database (if required) based on the values that were changed from the current row (that the trigger provides to you)  and then flush transactions from the bottom of your current table as required (or overnight using an SQL Agent Scheduled Task stored procedure).

The topic of triggers is too complicated to go into here - you will just need to go and read up about it but be warned you will almost certainly need to learn about stored procedures too (if you are not already familiar with them) as without them things get very complicated quite quickly.
0
 
LVL 1

Author Comment

by:Epurchase
ID: 37785818
Is there any way we can achieve the same using replication? I know the trigger option but wanted to do somehow using replication.
0
 
LVL 9

Expert Comment

by:lojk
ID: 37785900
Well, your original question ends..

"have to implement this in sql server. any other solution than replication."

Other than replication and using triggers, what else is there? clr doesn't supply any option that tsql doesn't already provide either.

I understand what you are trying to achieve I have done similar things too - using triggers, you could probably do something using a bunch of half baked client side code but it won't work (as well)

Have fun with this.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question