Snippets

Matt Meisberger History Table Id creator

Created by Matt Meisberger

select 
    t1.table_name, t1.table_rows from information_schema.TABLES t1 
JOIN information_schema.TABLES t2 on t2.table_name >= t1.table_name and t1.table_schema = t2.table_schema
where 
	t1.table_name like '%_History' and t1.table_schema = 'uba_domain_d9' 
	and t2.table_name like '%_History' and t2.table_schema = 'uba_domain_d9' 
group by t1.table_name
having count(1) % @partitionCount = @partitionExecuter and t1.table_rows > 0
limit 1
;

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.