-- query execution time from DMVs: https://dba.stackexchange.com/questions/232707/collect-sql-server-query-execution-time-in-seconds
SELECT TOP 50
st.text,
SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TOC] | |
--- | |
- [PowerShell cheatsheet](#powershell-cheatsheet) | |
- [Code Formatting](#code-formatting) | |
- [Search command history](#search-command-history) | |
- [Requirement](#requirement) | |
- [Function](#function) | |
- [Parameters](#parameters) | |
- [ShouldProcess and ShouldContinue](#shouldprocess-and-shouldcontinue) | |
- [Arrays and Hashtables](#arrays-and-hashtables) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.DESCRIPTION | |
Convert object to 2-dimensional object [Hashtable] with property path and value | |
.LINK | |
Source: https://stackoverflow.com/a/63152660/4582288 | |
#> | |
# function ConvertTo-2DObject { | |
[CmdletBinding()] |