Vandalism finder

4

Please login or register to vote for this query.

(click on this box to dismiss)

Finds my posts that were last edited by someone other than me. Enter user id and an optional set of comma-separated post id's to ignore (use a space to ignore nothing).

Economics

Q&A for those who study, teach, research and apply economics and econometrics

-- Vandalism finder
-- Finds my posts that were last edited by someone other than me.
-- Enter user id and an optional set of comma-separated post id's to ignore (use a space to ignore nothing).

DECLARE @UserId         INT = ##UserId##;
DECLARE @IgnorePosts    VARCHAR(4096) = ##PostsToIgnore:string##;

SELECT  
    P.Id               AS [Post ID]
  , P.LastEditorUserId AS [User Link]
  , P.Id               AS [Post Link]
  ,  CONVERT (VARCHAR(10), P.LastEditDate, 112)  AS [Edit Date]

FROM        Posts AS P
WHERE       P.OwnerUserId <> P.LastEditorUserId
AND         P.OwnerUserId = @UserId 
-- SLOW, but Ok for our small data set...
AND CharIndex (',' + CAST (P.Id AS VARCHAR) + ',', ',' + @IgnorePosts + ',') = 0 

ORDER BY
    P.LastEditorDisplayName
  , CONVERT (VARCHAR(10), P.LastEditDate, 112)  
  , P.Id

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results