Skip to content

Instantly share code, notes, and snippets.

@aabundez
aabundez / data_last_refreshed.pq
Created January 20, 2021 04:31
PQ for Data Last Refreshed
let
Source = #table(type table[Date Last Refreshed=datetime], {{DateTimeZone.SwitchZone(DateTimeZone.UtcNow(),-8)}}), //PST is UTC-8
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date Last Refreshed", type datetimezone}})
in
#"Changed Type"
@aabundez
aabundez / azsql_table_size.sql
Created March 14, 2021 20:09
Azure SQL Table Size + Properties
--Table size and properties
SELECT schema_name(t.schema_id) + '.' + t.name AS [table]
,p.[rows]
,cast(sum(spc.used_pages * 8) / 1024.00 AS NUMERIC(36, 2)) AS used_mb
,cast(sum(spc.total_pages * 8) / 1024.00 AS NUMERIC(36, 2)) AS allocated_mb
,p.index_id
,p.data_compression_desc AS [Index Data Compression]
,t.create_date
,t.lock_on_bulk_load
,t.lock_escalation_desc
@aabundez
aabundez / TMSCHEMA_COLUMNS-ExplicitDataType.txt
Last active April 15, 2021 03:10
ExplicitDataType codes in $SYSTEM.TMSCHEMA_COLUMNS
1 - (Calculated Column, so look at InferredDataType column)
2 - Text
6 - Whole Number
8 - Decimal Number
9 - Date
11 - Boolean
//https://docs.microsoft.com/en-us/analysis-services/tabular-models/data-types-supported-ssas-tabular?view=asallproducts-allversions
@aabundez
aabundez / azsql_running_queries.sql
Created March 3, 2022 18:23
What queries are running in Azure SQL Database?
SELECT r.session_id
,s.login_name
,c.client_net_address
,s.host_name
,s.program_name
,st.TEXT
,s.STATUS
FROM sys.dm_exec_requests r
INNER JOIN sys.dm_exec_sessions s ON r.session_id = s.session_id
LEFT JOIN sys.dm_exec_connections c ON r.session_id = c.session_id
@aabundez
aabundez / Get-AADGroupMembers.ps1
Last active September 18, 2023 23:40
This Powershell script lists all of the members of an Azure AD group
<#
.DESCRIPTION
This script returns the group members for a single group.
.LINK
https://learn.microsoft.com/en-us/powershell/module/azuread/get-azureadgroup?view=azureadps-2.0
https://learn.microsoft.com/en-us/powershell/module/azuread/get-azureadgroupmember?view=azureadps-2.0
#>