title: How to track cursor statements separately in SQL Server extended events?
body: <p>I want to track statements into SQL Server cursor using extended events but all solutions finding in internet does not work - for example, <a href="https://blog.pythian.com/extended-events-fetching-api-cursors/" rel="nofollow noreferrer">this</a>.</p>
  <p>Test code:</p>
  <pre class="lang-sql prettyprint-override"><code>DECLARE @objectId int;
  
  DECLARE cur CURSOR LOCAL FORWARD_ONLY STATIC READ_ONLY
  FOR
  SELECT TOP(3) object_id
  FROM sys.tables AS t
  ORDER BY object_id;
  
  OPEN cur;
  FETCH NEXT FROM cur INTO @objectId;
  WHILE @@FETCH_STATUS = 0
  BEGIN
      BEGIN TRAN;
      SELECT @objectId AS object_id;
      WAITFOR DELAY '00:00:01';
      COMMIT;
      FETCH NEXT FROM cur INTO @objectId;
  END;
  CLOSE cur;
  DEALLOCATE cur;
  </code></pre>