fn_dblog

  • Hi Experts,

    Will the below statement cause any issue on database??

    DECLARE @TableName sysname

    SET @TableName = 'dbo.ARA'

    SELECT

    u.[name] AS UserName

    , l.[Begin Time] AS TransactionStartTime

    FROM

    fn_dblog(NULL, NULL) l

    INNER JOIN

    (

    SELECT

    [Transaction ID]

    FROM

    fn_dblog(NULL, NULL)

    WHERE

    AllocUnitName LIKE @TableName + '%'

    AND

    Operation = 'LOP_DELETE_ROWS'

    ) deletes

    ON deletes.[Transaction ID] = l.[Transaction ID]

    INNER JOIN

    sysusers u

    ON u.[sid] = l.[Transaction SID]

    Please help as we are experiencing slowness in our DB.

  • Could slow down data modifications. It's not something I would run on production except in exceptional circumstances.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I agree with Gail. Also, you really should use sys.users not sysusers as sysusers is for backward compatibility and may be removed from future versions of SQL Server.

  • Thanks Gail & Lynn..

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply