Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set the Content Owner to the user who most recently modified the content
-- Set the Content Owner to the user who most recently modified the content
update cv
set cv.CV_Owner = cv.CV_ModifiedBy
from CV_ContentVersion cv
join C_Content c
with (nolock)
on c.C_ID = cv.CV_C_ID
join US_Users u
with (nolock)
on u.US_ID = cv.CV_ModifiedBy
where cv.CV_Owner is null
and cv.CV_ModifiedBy > 0
and (
cv.CV_ID = c.C_LiveVersionID
or cv.CV_ID = c.C_EditVersionID
)
update wpv
set wpv.WPV_Owner = wpv.WPV_ModifiedBy
from WPV_WebPageVersion wpv
join WP_Webpages wp
with (nolock)
on wp.WP_ID = wpv.WPV_WP_ID
join US_Users u
with (nolock)
on u.US_ID = wpv.WPV_ModifiedBy
where wpv.WPV_Owner is null
and wpv.WPV_ModifiedBy > 0
and (
wpv.WPV_ID = wp.WP_LiveVersionID
or wpv.WPV_ID = wp.WP_EditVersionID
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.