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
Author
Message
Posted Wednesday, October 23, 2013 9:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, January 06, 2014 5:06 AM
Points: 9, Visits: 25
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'')
begin
ALTER TABLE ? ADD [RowVersion] Rowversion NOT NULL;
end';

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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, April 18, 2014 2:24 PM
Points: 11,990, Visits: 11,007
Duplicate post. direct replies here. http://www.sqlservercentral.com/Forums/Topic1507706-2799-1.aspx

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ 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