Hi, I am trying to create a report which takes the instance_name and Database_name as input parameters and displays the table_name, row_count, column_count, size of the table. I am using the below query to populate the report.CREATE TABLE #temp ( table_name varchar(50) , row_count INT, reserved_size VARCHAR(50), data_size VARCHAR(50), index_size VARCHAR(50), unused_size VARCHAR(50)) SET NOCOUNT ONINSERT #temp EXEC sp_msforeachtable 'sp_spaceused "?"'SELECT a.table_name, a.row_count, COUNT(*) AS col_count, a.data_size FROM #temp a INNER JOIN information_schema.columns b ON a.table_name collate database_default = b.table_name collate database_default GROUP BY a.table_name, a.row_count, a.data_size ORDER BY CAST(REPLACE(a.data_size, 'KB', '') AS integer) DESCDROP TABLE #tempHowever, the report displays the following warnings and the table_name field is blank. All the other columns are displayed correctly. warning - Warning 1 [rsMissingFieldInDataSet] The dataset ‘Row_count’ contains a definition for the Field ‘Table_name’. This field is missing from the returned result set from the data source. Warning 2 [rsErrorReadingDataSetField] The dataset ‘Row_count’ contains a definition for the Field ‘Table_name’. The data extension returned an error during reading the field. There is no data for the field at position 1. Any help will be appreciated.
↧