Posts-1

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

/*
  select * from postTypes
  
  1  Question            
  2  Answer              
  3  Wiki                
  4  TagWikiExcerpt      
  5  TagWiki             
  6  ModeratorNomination 
  7  WikiPlaceholder     
  8  PrivilegeWiki  
*/

/*
  select * from posts where ownerDisplayName = 'user27134';
  id = '115541';
  ownerUserId = '27134';
*/

-- We can assume that displayName will be "user" + Identifier and that
-- the userId will be null, due to the previous user being deleted

declare @displayName nvarchar( 40 );
set @displayName = 'user27134';

-- Questions
select
  p.Id as postId,
  t.Name as postType,
  p.creationDate,
  p.viewCount,
  p.acceptedAnswerId,
  p.tags  
from posts p
inner join postTypes t on ( t.Id = p.postTypeId )
where ownerDisplayName = @displayName 
  and ownerUserId is null
order by p.postTypeId, postId asc;

-- My comments
select 
  id,
  postid,
  creationDate,
  userId,
  userDisplayName
from comments 
where userDisplayName = @displayName 
  and userId is null;

-- Reassociate these edits
select 
  p.id,
  t.Name,
  p.postId,
  p.creationDate,
  p.comment
from postHistory p
inner join postHistoryTypes t on ( t.Id = p.postHistoryTypeId )
where userDisplayName = @displayName 
  and userId is null;

/*
-- Answers
select
  p.Id as postId,
  t.Name as postType,
  p.creationDate, 0, 0, null
from posts p
inner join postTypes t on ( t.Id = p.postTypeId )
where ownerDisplayName = @displayName 
  and t.Name = 'Answer' 
  and ownerUserId is null
order by p.postTypeId, postId asc;

-- Wiki
select
  p.Id as postId,
  t.Name as postType,
  p.creationDate 
from posts p
inner join postTypes t on ( t.Id = p.postTypeId )
where ownerDisplayName = @displayName 
  and t.Name = 'Wiki' 
  and ownerUserId is null
order by p.postTypeId, postId asc;

-- Tag Wiki Excerpt
select
  p.Id as postId,
  t.Name as postType,
  p.creationDate
from posts p
inner join postTypes t on ( t.Id = p.postTypeId )
where ownerDisplayName = @displayName 
  and t.Name = 'TagWikiExcerpt' 
  and ownerUserId is null
order by p.postTypeId, postId asc;

-- Tag Wiki Body
select
  p.Id as postId,
  t.Name as postType,
  p.creationDate
from posts p
inner join postTypes t on ( t.Id = p.postTypeId )
where ownerDisplayName = @displayName 
  and t.Name = 'TagWiki' 
  and ownerUserId is null
order by p.postTypeId, postId asc;
*/
 
/*
  All of these tables do not contain a freetext field containing information
  that can be used to relink contents from a deleted account to a new
  account - in fact many of them use Community as the owner user so
  this will be completely unworkable without referring to a backup

  select * from votes;
  --select * from votetypes;
  select * from tagsynonyms;
  select * from tags;
  select * from suggestededits;
  select * from suggestededitvotes;
*/

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results