title: Alternative way to return the contents of the SQL Logs with TSQL
body: <p>Has anyone been able to work out another way to return the results of the SQL Server Logs. I know I can do it this way:</p>
  
  <pre><code>declare @sqlserverlogs table ( [LogDate] datetime, [ProcessInfo] varchar(10), 
      [Text] varchar(1000) )
  
  select @start_date = (current_timestamp -1), @end_date = current_timestamp
  
  insert into @sqlserverlogs exec sys.xp_readerrorlog 0, 1, '', '', 
      @start_date, @end_date, 'asc'
  
  select * from @sqlserverlogs
  </code></pre>
  
  <p>The programme I am using needs a table returned from a single select statement. Is there another way to return the contents of the SQL Server Logs, like a table from a function or a view or any other way?</p>
  
  <p>Cheers,
  Adam</p>