Table count comparison in a SSIS package
In our production environment, I have a SSIS package to import from OLTP SQL Server database to Data Warehouse (in SQL Server) and from there another package imports from Data warehouse to a Tabular SSAS database.

For health check reason, I would like to develop a SSIS package to compare table counts between production OLTP, Data warehouse and Tabular databases. I know how to do it for SQL Server databases but have no idea how to calculate table counts of Tabular tables and save the results to a SQL Server table to compare the counts.

Has any body done this? Any clue?

Thanks
January 31st, 2015 1:50am

one option is to query the a ssas DMV in a DataFlow...

SELECT	*
FROM	$SYSTEM.DBSCHEMA_TABLES 
WHERE	TABLE_CATALOG = 'AdventureWorks Tabular Model SQL 2012' AND 
		TABLE_TYPE = 'TABLE' AND
		TABLE_SCHEMA = 'Model'

...and capture the RowCount to a variable.

Free Windows Admin Tool Kit Click here and download it now
January 31st, 2015 2:04am

Thanks.

There was no RowCount in the result set but your suggestion provide me with a clue and here is what I ended up getting the Record counts:

SELECT Distinct Measure_Group_Name, Partition_Name, RECORDS_COUNT FROM $SYSTEM.DISCOVER_STORAGE_TABLE_COLUMN_SEGMENTS 
WHERE PARTITION_NAME >'' ORDER BY PARTITION_NAME

  • Marked as answer by AL.M Friday, January 30, 2015 11:54 PM
January 31st, 2015 2:54am

rowcount is an SSIS dataflow component...but i see now that i misunderstood your question...thought you were asking how to get a count of the number of tables in the model (not a count of the rows in each table).  glad you figured it out ;-)
Free Windows Admin Tool Kit Click here and download it now
January 31st, 2015 3:28am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics