Get all edits by a user

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @userId INT = ##UserId:int##;

SELECT
            /*  Note that UserDisplayName is only used for deleted/migrated users
                who have no (publicly accessible) User ID. 
            */
            ph.UserDisplayName      AS [Deleted User name, if any],
            ph.CreationDate         AS [Date],
            ph.PostId               AS [Post Link],
            ph.Comment,
            ph.Text
FROM        PostHistory ph
WHERE       ph.UserId   = @userId
AND         ph.PostHistoryTypeId    BETWEEN 1 and 9 -- Create, edit, rollback
ORDER BY    ph.CreationDate DESC

Enter Parameters

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