Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

RowVersion Change Expand / Collapse
Posted Wednesday, October 23, 2013 9:43 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, August 19, 2015 8:22 AM
Points: 65, Visits: 186
I would like to try and get the Rowversion change snuck into the schedule sometime soon.

An overview of this plan:
If we use the following command we can add a rowversion column to every table in both our main and settings databases.
EXEC sp_MSforeachtable '
if not exists (select * from sys.columns
where object_id = object_id(''?'')
and name = ''RowVersion'')
ALTER TABLE ? ADD [RowVersion] Rowversion NOT NULL;

With the rowversion column in place we can quickly check that data we are about to update is not stale, without having to read entire row into memory.
This is targeted more at disconnected/web service application contexts.
Entity Framework can be configured to take advantage of the column as well.

The plan was to add a one-time entry into the each of the update scripts to initialize this on all of the tables. And then add code to always run this command after main data or setting data updates are triggered (actually do something).

Any tips or best way to implement this???
Post #1507710
Posted Wednesday, October 23, 2013 10:06 AM



Group: General Forum Members
Last Login: Today @ 3:02 PM
Points: 14,970, Visits: 14,879
Duplicate post. direct replies here.


Need help? Help us help you.

Read the article at for best practices on asking questions.

Need to split a string? Try Jeff Moden's 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)
Post #1507723
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse