Cannot Update/Insert on a replicated table
I have defined a unidirectional publication of a table on SQL Server. On the subscriber side(SQL Compact), I need to be able to retrieve the contents of the table and modify them, BUT these modifications must NOT be sent back to the publisher. From time to time, the contents of the table must be reinitialized with the updated version from the publisher, dropping all the modifications that were made locally. I do not care about any conflicts that can arise, as the data will not be s开发者_开发技巧ent back to the server.
The problem is that I cannot Update/Insert/Delete any rows in the table, unless I publish the table as "bidirectional", which is not what I want. When trying an update on this table(on the client side), I get the following error:
SSCE_M_READONLY "While performing an RDA Push, SQL Server Compact was only able to obtain a read-only cursor on the table(s) being pushed to SQL Server. There could be locking conflicts on SQL Server while trying to do the push. Verify that the table on SQL Server is updatable and try again."
So basically, what I want is:
- get the data from the server
- work on the data(insert/update/delete)
- delete all modified rows
- synchronize the table(get a 'clean' version from the server)
I'd prefer not to re-download all the contents of the table when synchronizing, but this is not a MUST.
Replication is all about maintaining consistency of the data between Publisher and Subscriber so I would say you don't want to use it in your situation.
What about setting up an SSIS package that you could run periodically? It would do a lookup and insert new rows and reset existing rows back to whatever the publisher has for them. Similar to what's described here:
http://beingoyen.blogspot.com/2010/03/ssis-how-to-update-instead-of-insert.html
精彩评论