-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jamiet
committed
Dec 30, 2013
1 parent
944a49e
commit 5c9314e
Showing
3 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
TSQLCodeLibrary/jt/Stored Procedures/GetPartitionRowTallies.sql
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CREATE PROCEDURE jt.GetPartitionRowTallies | ||
@dbName SYSNAME = 'master' | ||
AS | ||
BEGIN | ||
DECLARE @sql NVARCHAR(MAX) = ' | ||
SELECT t.name | ||
,s.partition_number | ||
,s.row_count | ||
FROM [@dbname].sys.dm_db_partition_stats AS s | ||
INNER JOIN [@dbname].sys.tables AS t ON t.[object_id] = s.[object_id] | ||
GROUP BY t.name | ||
,s.partition_number | ||
,s.row_count; | ||
'; | ||
SET @sql = REPLACE(@sql,'@dbName',@dbName) | ||
EXEC (@sql) | ||
END |
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