title: How to retrieve dropped stored procedure, function, table in SQL Server 2008
body: <p><b>I verified the link below as some one (@Oliver) posted as duplicate of my Question. But this query returns last execution script. It is not related to my question.</b></p>
  
  <p><a href="https://stackoverflow.com/questions/13638435/last-executed-queries-for-a-specific-database">Last executed queries for a specific database</a></p>
  
  <p>I have a database with Sample_Training and I created a stored procedure in it and later on I deleted it and now I want to retrieve that deleted stored procedure. </p>
  
  <p>I am employee in company so that I don't have administrative permissions</p>
  
  <pre><code>DECLARE @Date_From DATETIME = '2015-01-02'
  DECLARE @Date_To DATETIME = '2015-01-05'
  
  SELECT 
      CONVERT(VARCHAR(MAX), SUBSTRING([RowLog Contents 0], 33, LEN([RowLog Contents 0]))) AS [Script]
  FROM
      fn_dblog(NULL,NULL)
  WHERE 
      [Operation] = 'LOP_DELETE_ROWS' 
      AND [Context] = 'LCX_MARK_AS_GHOST'
      AND [AllocUnitName] = 'sys.sysobjvalues.clst'
      AND [TRANSACTION ID] IN (SELECT DISTINCT [TRANSACTION ID] 
                               FROM sys.fn_dblog(NULL, NULL)
                               WHERE Context IN ('LCX_NULL') AND Operation IN ('LOP_BEGIN_XACT') 
                                 AND [Transaction Name] = 'DROPOBJ'
                                 AND CONVERT(NVARCHAR(11), [Begin Time]) BETWEEN @Date_From AND @Date_To)
                                 AND SUBSTRING([RowLog Contents 0], 33, LEN([RowLog Contents 0])) &lt;&gt; 0
  </code></pre>
  
  <p>By the above query I can get stored procedure and now my question is how to get function, table.</p>