Monday, March 19, 2012

How can client applications know if a table has been changed by another user?

Is there a mechanism in SQL Server 2000 for notifying client apps in a
multiuser setting when a change has occurred in a table (notification
event).
And/Or, is there a way a client application can 'ask' if a table has
changed?
Thanks,
WykDo you want to know whether that table design is changed or records are
added?
Madhivanan|||In both the cases you have to create your own extensions
to handle the requirement.
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Madhivanan" <madhivanan2001@.gmail.com> wrote in message
news:1109581918.952377.73540@.z14g2000cwz.googlegroups.com...
> Do you want to know whether that table design is changed or records are
> added?
> Madhivanan
>|||It seems like you are describing an optimistic locking strategy. SQL
Server provides a ROWVERSION datatype (also called TIMESTAMP) to track
changes to a row. The client retrieves the data, including timestamp
and then, immediately before saving a change or performing other
actions, the retrieved timestamp is compared to the current one in the
table to determine if the data has changed.
David Portas
SQL Server MVP
--|||> ...The client retrieves the data, including timestamp
> and then, immediately before saving a change or performing other
> actions, the retrieved timestamp is compared to the current one in the
> table to determine if the data has changed.
Or, in the UPDATE, you include the buffered rowversion value in the WHERE cl
ause (with the primary
key value). If the update modifies zero rows, you know that either the row w
as deleted or it was
updated.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1109586059.793247.265620@.f14g2000cwb.googlegroups.com...
> It seems like you are describing an optimistic locking strategy. SQL
> Server provides a ROWVERSION datatype (also called TIMESTAMP) to track
> changes to a row. The client retrieves the data, including timestamp
> and then, immediately before saving a change or performing other
> actions, the retrieved timestamp is compared to the current one in the
> table to determine if the data has changed.
> --
> David Portas
> SQL Server MVP
> --
>|||LOL. First time I noticed your signature, Joe, I thought that SQLNS referred
to the SQL-NS API with
which you can re-use dialogs from EM in your client app. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe Webb" <joew@.webbtechsolutions.com> wrote in message
news:uT5aNdaHFHA.3108@.tk2msftngp13.phx.gbl...
> If you're asking about a way in which a client application can be notified
of new or even updated
> records on the server, then you may want to check out Notification Service
s. The provided Realtor
> sample provides a simple example.
>
> HTH...
> Joe Webb
> SQL Server MVP
> ~~~
> Get up to speed quickly with SQLNS
> http://www.amazon.com/exec/obidos/t...il/-/0972688811
>
>
> Tibor Karaszi wrote:

No comments:

Post a Comment