Sql-server – MSrepl_tran_version? (MS SQL Server)

sql server

So, I'm an "enterprise software developer" (welcome to hell, here's your accordion), meaning I'm not a DBA and I'm inheriting something that's been around for years and very few people have a crisp explanation for much at all.

My question: what, exactly, is msrepl_tran_version? We have it in all our tables (a rather large number), but I don't believe we're using replication. I guess we did at some point in the past, maybe.

However, we seem to be using this field for concurrent-update detection; at update time, we check this field to see if it's changed, and, if so, reject the user's change (error on the screen, force them to refresh, etc., etc.0

Does this field get updated magically, somehow? Should I be looking for a trigger? (I doubt it.) If we're not using replication, what do changes in this field affect? I can't seem to actually find a good overview explanation of what this column is.

TIA.

John.

Best Answer

what, exactly, is msrepl_tran_version? We have it in all our tables (a rather large number), but I don't believe we're using replication. I guess we did at some point in the past, maybe.

when you have configured Transactional replication with updatable subscriptions, replication adds the column msrepl_tran_version to every table. If the table is dropped from the publication, the msrepl_tran_version column is not removed.

Check with your DBA to see if you still have replication or not.

If you are not using Replication, then to see how this column gets updated, I would suggest you to use profiler.

IF this column is not being used anymore, you should be good to remove/drop it. Refer to my answer with script here.