I can get the row count of all tables using this query.
SELECT '[' + SCHEMA_NAME(t.schema_id) + '].[' + t.name + ']' AS fulltable_name, SCHEMA_NAME(t.schema_id) AS schema_name, t.name AS table_name,
i.rows
FROM sys.tables AS t INNER JOIN
sys.sysindexes AS i ON t.object_id = i.id AND i.indid < 2
**AND
t.name.programID = 4**
but I need to count all rows where programID = n
I keep getting the following error when adding the bolded line to the where clause
Cannot call methods on nvarchar.
Any help is greatly needed an appreciated
Andy
The table name in your example can not be accessed like a property. It’s just a string and not the table itself. I’ve comprised a solution that may work for you. It feels a little like a hack, but It will get you on your way.