Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Get Latest SQL Query for Sessions

Posted on April 29, 2013October 26, 2015 By David Kittell
SELECT session_id
    ,TEXT
FROM sys.dm_exec_connections
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS ST

Reference: http://blog.sqlauthority.com/2010/05/05/sql-server-get-latest-sql-query-for-sessions-dmv/

Originally Posted on April 29, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code MSSQL - Audit

Post navigation

Previous post
Next post

Related Posts

List Views In Database

Posted on February 25, 2013October 26, 2015

SELECT name FROM sys.views ORDER BY name SET NOCOUNT ON DECLARE @ViewName AS nVarChar(128) , @Query AS nVarChar(500) /* Declare Cursor */ DECLARE Cur_Views CURSOR FOR SELECT name FROM [sys].[all_views] x WHERE x.schema_id = 1 — Loop through the views. OPEN Cur_Views — Fetch the first view FETCH NEXT FROM…

Read More

PHP – Latitude Latitude to Maidenhead Grid – HAM Radio

Posted on June 14, 2020August 17, 2024

Recently I was asked by a HAM Radio friend to work on a conversion of latitude and longitude coordinates to maidenhead grid. The code below is in “rough” PHP code on purpose to help illustrate the math behind the conversion. Feel free to clean/optimize it all I ask is that…

Read More

Windows 7 – Disable Hibernate Mode

Posted on February 1, 2016

Disable Hibernate powercfg -h off Enable Hibernate powercfg -h on All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • PowerShell - Get Text Encoding Type
  • Front Page
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • Bleaching Wool using Hydrogen Peroxide

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • PowerShell - Get Text Encoding Type
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • Bleaching Wool using Hydrogen Peroxide
  • PowerShell - IIS Remove Site
  • Javascript - Digital Clock with Style
©2025 David Kittell | WordPress Theme by SuperbThemes
David Kittell
  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support