Skip to content

Instantly share code, notes, and snippets.

@aabundez
aabundez / data_last_refreshed.pq
Created Jan 20, 2021
PQ for Data Last Refreshed
View data_last_refreshed.pq
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 Mar 14, 2021
Azure SQL Table Size + Properties
View azsql_table_size.sql
--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 Apr 15, 2021
ExplicitDataType codes in $SYSTEM.TMSCHEMA_COLUMNS
View TMSCHEMA_COLUMNS-ExplicitDataType.txt
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