Script to check whats hogging the system
This script takes 2 samples over a 10 second period to identify what spids are using most resources. It's probably not 100% accurate but it's helped me out a few times.
2003-05-15
529 reads
This script takes 2 samples over a 10 second period to identify what spids are using most resources. It's probably not 100% accurate but it's helped me out a few times.
2003-05-15
529 reads
If you have environment where you restrict access to database objects based on user roles and if you have a lot of databases on different servers in the same domain. The following script can generate roles from a given database in a format that can be used to create roles on different servers where the […]
2003-05-14
209 reads
Mod to Find the Nth Occurence of a characterFixes when you are looking for the third character and there is only one, was setting @pos back to 0 if there was only 1 of the characters. Also provided for the @occurence to be 0.
2003-05-13
393 reads
This script identifies the blocking locks at the top of the blocking chain and kills them. Specifically, it reports what the top blocking spids are doing, kills them, waits three seconds and then reports on current blocking status. If you have a situation where single connections are causing a huge blocking chain and you want […]
2003-05-12
4,504 reads
This is a followup to the script submitted by srallapalli. One can return a record set of all tables in a database using the following:USE MyDatabaseSELECT so.name AS TableName, sc.name AS ColumnName, st.name AS ColumnDatatype, convert(int, sc.length) AS ColumnLength FROM syscolumns sc, sysobjects so , systypes st WHERE so.type='U' AND OBJECTPROPERTY(so.id,'ismsshipped') = 0 AND sc.id=so.id […]
2003-05-10
170 reads
In instances where you have over 16 data files, or you need to move data files to a new location when you are moving a database you must use a CREATE...FOR ATTACH statement. This script will generate the CREATE...FOR ATTACH statement dynamically given a database name. It will take into consideration the file sizes, growths […]
2003-05-07
248 reads
For each user database rebuild indexes, update statistics and shrink. The script will use the system catalog to produce a list of databases. If you want to excluce a database add the excluded db name to the 'not in' list. You can also adjust the target fillfactor.
2003-05-07
1,881 reads
This set of procedures allow you to control simultaneous access to any resource you are using. It mimics the behaviour of a Semaphore in programming.A typical problem where you need this, is when you have a computational intensive procedure you only want to be started a limited number of times.First, add a record to the […]
2003-05-07
300 reads
This script enables you to return data from SQL Server's table without specyfing the name of the column .All you only need to supply is the column number, that you want the data from. In the example we want to chose all rows from the second column (categories table - northwind) Column number is based […]
2003-05-07
188 reads
For each user database remove all the freespace and truncate the transaction log. The script will use the system catalog to produce a list of databases. If you want to excluce a database add the excluded db name to the 'not in' list below.
2003-05-07
1,580 reads
A RAG pipeline that answers questions in the demo is not the same thing...
By Steve Jones
“A multitude of bad ideas is necessary for one good idea” – from Excellent...
Yesterday I gave a talk for MSSQLTips called “Building a DBA Agent for Your...
I've got a web application for my side business. I've added a SQL Server...
Comments posted to this topic are about the item Looking for New Blood
Comments posted to this topic are about the item Server-Level Row Counts for Tables...
What types of secondary replicas are available for the Azure SQL Database Hyperscale edition?
See possible answers