You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TSQLCodeLibrary/jt/Stored Procedures/AllPermissions.sql
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -45,3 +45,6 @@ ON rm.role_principal_id = p.principal_id
45
45
order by 1';
46
46
SET @SQL =rePLACE(@SQL,'@dbName',@dbName)
47
47
EXEC (@SQL)
48
+
49
+
GO
50
+
EXEC sp_addextendedproperty @level0name='jt',@level0type='SCHEMA',@level1name='AllPermissions',@level1type='PROCEDURE',@name='CodeLibraryDescription',@value='All permissions granted to any user, either directly or via role membership.';
Copy file name to clipboardExpand all lines: TSQLCodeLibrary/jt/Stored Procedures/GetPartitionRowTallies.sql
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,4 +14,7 @@ BEGIN
14
14
';
15
15
SET @sql =REPLACE(@sql,'@dbName',@dbName)
16
16
EXEC (@sql)
17
-
END
17
+
END
18
+
19
+
GO
20
+
EXEC sp_addextendedproperty @level0name='jt',@level0type='SCHEMA',@level1name='GetPartitionRowTallies',@level1type='PROCEDURE',@name='CodeLibraryDescription',@value='Tally of rows per partition in a given database.';
Copy file name to clipboardExpand all lines: TSQLCodeLibrary/jt/Stored Procedures/GetTableRowTallies.sql
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -12,4 +12,7 @@ BEGIN
12
12
SELECTname,row_count =SUM(row_count)
13
13
FROM #t
14
14
GROUP BYname;
15
-
END
15
+
END
16
+
17
+
GO
18
+
EXEC sp_addextendedproperty @level0name='jt',@level0type='SCHEMA',@level1name='GetTableRowTallies',@level1type='PROCEDURE',@name='CodeLibraryDescription',@value='Tally of rows per table in a given database.';
Copy file name to clipboardExpand all lines: TSQLCodeLibrary/jt/Stored Procedures/TableStats.sql
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -204,4 +204,6 @@ jamie@jamie-thomson.net
204
204
SELECT*
205
205
FROM @table_metrics;
206
206
207
-
;
207
+
;
208
+
GO
209
+
EXEC sp_addextendedproperty @level0name='jt',@level0type='SCHEMA',@level1name='TableStats',@level1type='PROCEDURE',@name='CodeLibraryDescription',@value='Stats per table. Provides Rowcount, Does it have a clustered index?, Is the primary key clustered?, Number of columns, Number of unique, none-primary keys, Number of none unique columns';
--Determining the Total Amount of Space (Free and Used)
25
25
SELECTSUM(size)*1.0/128AS [size in MB]
26
-
FROMtempdb.sys.database_files
26
+
FROMtempdb.sys.database_files
27
+
28
+
GO
29
+
EXEC sp_addextendedproperty @level0name='jt',@level0type='SCHEMA',@level1name='tempdbStats',@level1type='PROCEDURE',@name='CodeLibraryDescription',@value='Loads of useful information about tempdb.';
Copy file name to clipboardExpand all lines: TSQLCodeLibrary/jt/Views/vwAllSessions.sql
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,4 +24,6 @@ from sys.dm_exec_sessions s
24
24
left outer joinsys.dm_exec_connections c
25
25
onc.session_id=s.session_id
26
26
left outer joinsys.dm_exec_requests r
27
-
onr.session_id=s.session_id
27
+
onr.session_id=s.session_id
28
+
GO
29
+
EXEC sp_addextendedproperty @level0name='jt',@level0type='SCHEMA',@level1name='vwAllSessions',@level1type='VIEW',@name='CodeLibraryDescription',@value='All current sessions, plus info from sys.dm_exec_requests';
Copy file name to clipboardExpand all lines: TSQLCodeLibrary/jt/Views/vwCacheUsagePerTable.sql
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -33,4 +33,6 @@ SELECT TOP 20 DB_NAME(database_id) AS 'Database'
33
33
, SUM(dirtyPage) AS'Dirty Pages'
34
34
FROM memusage_CTE
35
35
GROUP BY database_id, object_id, index_id
36
-
ORDER BYCOUNT(*) DESC
36
+
ORDER BYCOUNT(*) DESC
37
+
GO
38
+
EXEC sp_addextendedproperty @level0name='jt',@level0type='SCHEMA',@level1name='vwCacheUsagePerTable',@level1type='VIEW',@name='CodeLibraryDescription',@value='Show cache usage per table. Taken from a blog by Steve Hindmarsh at http://sqlblogcasts.com/blogs/steveh/archive/2010/04/02/dbcc-memusage-in-2008.aspx';
0 commit comments