Created
December 10, 2019 21:11
-
-
Save siennathesane/20e7c0255be27b9cd05e7d567a63c7c5 to your computer and use it in GitHub Desktop.
This file contains 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
use timeseriesdb | |
declare @now datetime2 = sysutcdatetime() | |
select avg(count) from (select count(*) from (select COLUMN_NAME | |
from (select * | |
from INFORMATION_SCHEMA.COLUMNS | |
where TABLE_SCHEMA = 'default' and TABLE_NAME = 'timeseriestable' | |
) | |
where COLUMN_NAME = '%pattern') | |
where time_primary_key <= @now | |
and time_primary_key >= dateadd(minute , -30, @now) | |
order by time_primary_key) as count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment