-
-
Save rdsaunders/a311681ce4e8974b5ba4005fe9dcadc8 to your computer and use it in GitHub Desktop.
Set the content owner of all content items to the creator of 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 created the content | |
update cv | |
set cv.CV_Owner = c.C_CreatedBy | |
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 = c.C_CreatedBy | |
where cv.CV_Owner is null | |
and c.C_CreatedBy > 0 | |
and ( | |
cv.CV_ID = c.C_LiveVersionID | |
or cv.CV_ID = c.C_EditVersionID | |
) | |
update wpv | |
set wpv.WPV_Owner = wp.WP_CreatedBy | |
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 = wp.WP_CreatedBy | |
where wpv.WPV_Owner is null | |
and wp.WP_CreatedBy > 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