码迷,mamicode.com
首页 > 数据库 > 详细

Delete All Umbraco Members by SQL Script (转自http://staheri.com/my-blog/2015/july/delete-all-umbraco-members-by-sql-script/)

时间:2015-10-23 16:09:30      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:

Today I had to take the back-up off a live site and restore it on the staging server. However I had to remove all Umbraco members and thought it‘d be easier to do that with SQL script than API.

Despite Googling to find a firm solution (SQL script), I couldn‘t find one, so I decided to share this code in case anyone else wanted to delete all Umbraco members with SQL script rather than API.

This what I have come up with so far, and it seems to have removed all the members, but please leave a comment if you think there is a better way of doing this, or if any other data needs to be removed from any other table.

1
2
3
4
5
6
7
8
9
10
11
delete from cmspropertydata where cmsPropertyData.contentNodeId in (select nodeid from cmsMember)
delete from dbo.cmsContentVersion where ContentId in (select nodeId from cmsMember)
delete from dbo.cmsMember2MemberGroup where member in (select nodeId from cmsMember)
delete from cmsContentXml where nodeId in (select nodeId from cmsMember)
delete from cmsPreviewXml where nodeId in (select nodeId from cmsMember)
create table #CmsMemberIds ( nodeId int )
insert into #CmsMemberIds select nodeId from cmsMember
delete from cmsMember
delete from cmsContent where nodeId in (select nodeid from #CmsMemberIds)
delete from dbo.umbracoNode where id in (select nodeId from #CmsMemberIds)
drop table #CmsMemberIds

Delete All Umbraco Members by SQL Script (转自http://staheri.com/my-blog/2015/july/delete-all-umbraco-members-by-sql-script/)

标签:

原文地址:http://www.cnblogs.com/sharpcontext/p/4904658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!