Last active
March 14, 2017 15:00
-
-
Save rdsaunders/e56bcc66b39e27a4277e840da071dfe2 to your computer and use it in GitHub Desktop.
Set the Content Owner to the user who most recently modified the content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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