Showing posts with label inserted. Show all posts
Showing posts with label inserted. Show all posts

Monday, March 19, 2012

Data deleted from database

Hi,
I have a merge replication set on a database.
day before yesterday I inserted some 10000 records in a table being
replicated.
The records did get insterted successfully but next day morning when I
checked I found that those records are not present in that table.
I checked all possible ways, data could have deleted but I don't find any
thing.
I see that those records are there in the conflic table because they could
not get replicated because of identity calumn. But that should not delete
records from the table.
I 'm confused and need help.
Thanks
SamHi
Are you sure they were commited? You might have inserted them, looked at the
data, and when you closed the connection, the data got rolled back.
Regards
Mike
"Sam" wrote:

> Hi,
> I have a merge replication set on a database.
> day before yesterday I inserted some 10000 records in a table being
> replicated.
> The records did get insterted successfully but next day morning when I
> checked I found that those records are not present in that table.
> I checked all possible ways, data could have deleted but I don't find any
> thing.
> I see that those records are there in the conflic table because they could
> not get replicated because of identity calumn. But that should not delete
> records from the table.
> I 'm confused and need help.
> Thanks
> Sam
>
>|||I can say that they were committed because out of 8 table's data I inserted,
4 tables kept the data and 4 did not.
And those 4 who did not keep the data sill have the same records in their
respective conflict tables because of the identity issue.
I don't understand this behaviour.
Please help
Sam
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:7CA4AF30-B285-4463-9142-83DE6233515E@.microsoft.com...[vbcol=seagreen]
> Hi
> Are you sure they were commited? You might have inserted them, looked at
> the
> data, and when you closed the connection, the data got rolled back.
> Regards
> Mike
> "Sam" wrote:
>

Data deleted from database

Hi,
I have a merge replication set on a database.
day before yesterday I inserted some 10000 records in a table being
replicated.
The records did get insterted successfully but next day morning when I
checked I found that those records are not present in that table.
I checked all possible ways, data could have deleted but I don't find any
thing.
I see that those records are there in the conflic table because they could
not get replicated because of identity calumn. But that should not delete
records from the table.
I 'm confused and need help.
Thanks
Sam
Hi
Are you sure they were commited? You might have inserted them, looked at the
data, and when you closed the connection, the data got rolled back.
Regards
Mike
"Sam" wrote:

> Hi,
> I have a merge replication set on a database.
> day before yesterday I inserted some 10000 records in a table being
> replicated.
> The records did get insterted successfully but next day morning when I
> checked I found that those records are not present in that table.
> I checked all possible ways, data could have deleted but I don't find any
> thing.
> I see that those records are there in the conflic table because they could
> not get replicated because of identity calumn. But that should not delete
> records from the table.
> I 'm confused and need help.
> Thanks
> Sam
>
>
|||I can say that they were committed because out of 8 table's data I inserted,
4 tables kept the data and 4 did not.
And those 4 who did not keep the data sill have the same records in their
respective conflict tables because of the identity issue.
I don't understand this behaviour.
Please help
Sam
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:7CA4AF30-B285-4463-9142-83DE6233515E@.microsoft.com...[vbcol=seagreen]
> Hi
> Are you sure they were commited? You might have inserted them, looked at
> the
> data, and when you closed the connection, the data got rolled back.
> Regards
> Mike
> "Sam" wrote:

Data deleted from database

Hi,
I have a merge replication set on a database.
day before yesterday I inserted some 10000 records in a table being
replicated.
The records did get insterted successfully but next day morning when I
checked I found that those records are not present in that table.
I checked all possible ways, data could have deleted but I don't find any
thing.
I see that those records are there in the conflic table because they could
not get replicated because of identity calumn. But that should not delete
records from the table.
I 'm confused and need help.
Thanks
SamHi
Are you sure they were commited? You might have inserted them, looked at the
data, and when you closed the connection, the data got rolled back.
Regards
Mike
"Sam" wrote:
> Hi,
> I have a merge replication set on a database.
> day before yesterday I inserted some 10000 records in a table being
> replicated.
> The records did get insterted successfully but next day morning when I
> checked I found that those records are not present in that table.
> I checked all possible ways, data could have deleted but I don't find any
> thing.
> I see that those records are there in the conflic table because they could
> not get replicated because of identity calumn. But that should not delete
> records from the table.
> I 'm confused and need help.
> Thanks
> Sam
>
>|||I can say that they were committed because out of 8 table's data I inserted,
4 tables kept the data and 4 did not.
And those 4 who did not keep the data sill have the same records in their
respective conflict tables because of the identity issue.
I don't understand this behaviour.
Please help
Sam
"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:7CA4AF30-B285-4463-9142-83DE6233515E@.microsoft.com...
> Hi
> Are you sure they were commited? You might have inserted them, looked at
> the
> data, and when you closed the connection, the data got rolled back.
> Regards
> Mike
> "Sam" wrote:
>> Hi,
>> I have a merge replication set on a database.
>> day before yesterday I inserted some 10000 records in a table being
>> replicated.
>> The records did get insterted successfully but next day morning when I
>> checked I found that those records are not present in that table.
>> I checked all possible ways, data could have deleted but I don't find any
>> thing.
>> I see that those records are there in the conflic table because they
>> could
>> not get replicated because of identity calumn. But that should not delete
>> records from the table.
>> I 'm confused and need help.
>> Thanks
>> Sam
>>

Thursday, March 8, 2012

Data comparison and update

Hello All,

I have two tables T1 and T2 with the same data structure. I need to compare T1 with T2 for all columns and update T2 for deleted, inserted and updated rows. How can I do this?

Are you duplicating the T1 data into T2? If so, why not simply delete all T2 rows and insert all T1 rows into T2 (or drop T2 and then recreate it from T1, including data)?|||

Hello,

Thanks you very much for the reply. T1 is big and is changing constantly and I am trying to find the discrepancy between T1 and T2 and update T2 based on the discrepancies. SO trying to realize synchronization on a single table. Any idea?

|||I haven't used Triggers in a long time, but it may be a good solution to your situation. Set up the Triggers for UPDATE, INSERT and DELETE operations and have it synchronize your T2 table accordingly. Once the Triggers are defined (and tested), you don't even have to worry about it. Be sure that performance isn't hit by doing this, though.|||

Sorry Jim, wish I could help you, but I'm currently bound by some confidentiality agreements that prohibit me from discussing this in much detail. But here are some choices:

Use a trigger to update t1 whenever t2 is updated (If you need them to be synchronized in realtime, including transaction consistancy). But since they are the same structure, there is usually little reason for implementing it this way.

Replication. You can use this to replicate data from server to server, and probably from table to table as well. There are so many options on how this can be done, it'll take you a while to research and test the possibilities.

Diff-gramming. Write queries to automatically insert, update, and delete those rows which differ from table1 to table2.