<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Snippets on StraightforwardSQL</title>
    <link>https://straightforwardsql.com/snippets/</link>
    <description>Recent content in Snippets on StraightforwardSQL</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language><atom:link href="https://straightforwardsql.com/snippets/rss.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Parse TSQL Stack</title>
      <link>https://straightforwardsql.com/snippets/parse-tsql-stack/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://straightforwardsql.com/snippets/parse-tsql-stack/</guid>
      <description>Parse the tsql_stack XML from an Extended Events session into a readable call stack. Paste the &amp;lt;frames&amp;gt; element from the XE event data into the @stackOrFrame variable.
The COALESCE handles both the old (handle/offsetStart/offsetEnd) and new (sqlhandle/stmtstart/stmtend) XE frame attribute names.
/* Paste the &amp;lt;frames&amp;gt;&amp;lt;/frames&amp;gt; here */ DECLARE @stackOrFrame xml = &#39;&#39; ;WITH xmlShred AS ( SELECT COALESCE ( CONVERT(varbinary(64), f.n.value(&#39;.[1]/@handle&#39;, &#39;varchar(max)&#39;), 1), CONVERT(varbinary(64), f.n.value(&#39;.[1]/@sqlhandle&#39;, &#39;varchar(max)&#39;), 1) ) AS handle, COALESCE ( f.</description>
    </item>
    
    <item>
      <title>XE Watch Live Data</title>
      <link>https://straightforwardsql.com/snippets/xe-watch-live-data/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://straightforwardsql.com/snippets/xe-watch-live-data/</guid>
      <description>Once you have an XE session running, you can stream its events live in SSMS without needing a file target. Right-click the session in Object Explorer and choose Watch Live Data.
Caveats:
No memory, no history. There is no target backing the session, so you can only see events that fire while you are actively watching. Anything that happened before you opened the live view is gone. The session keeps running.</description>
    </item>
    
  </channel>
</rss>