Search this site!

Utility SPs for developers / administrators alike. These scripts will work in MS SQL 70. It may require some modifications for the next release. I will post updates as and when i modify them. These scripts address several issues with the existing system SPs. The enterprise manager "Current Activity" window doesn't really help in a busy production environment owing to its usage of temporary tables to display the data etc. It does not provide powerful search capabilities also. I think i've got most of these taken care of in these SPs. Please leave the header, details in these Sps for clarity sakes & for others to benefit by them. Hope you find these useful & wish that it simplifies some of your daily chores! Please send any questions, suggestions, bugs to .
Thanks for checking this out!

 

Click here to download the SQL scripts.

1) This script shows how to get details about an orphan process in SQL70.

Orphan Process Details using DBCC PSS.sql

2) This SP can be used to search for a string in the last input command sent to SQL Server from a user connection. The search can be done based on SPIDs or username.

SP_SIO.SQL

3) This SP demonstrates how to generate INSERT statements for a table.

sp_genstmt.SQL

4) Just a wrapper SP with a short name that calls my sp_who_ex SP & the blocking locks SP from Kalen's website.

SP_B.SQL

5) A SP to view the blocking locks in a database. Taken from Kalen's InsideSQLServer website.

sp_blockinglocks.sql

6) This is the modified version of the system SP to fix the arithmetic overflow errors.

sp_checktabletempsize - modified to fix numeric overflow errors.sql

7) This SP is used to generate a default template with DROP, CREATE, GRANT for SPs, Views & Triggers. The template also contains a comment that can use the Visual SourceSafe keyword expansion feature to maintain history of the changes.

sp_ghf.SQL

8) This SP can be used to list the i/o buffer of a specific SPID. The SPIDs can be specified as a list or the username can be specified.

SP_TLIST.SQL

9) This SP allows powerful search capabilities & ordering features for the processes using SQL Server. This does not use temporary tables & hence works better than the EM current activity window.

sp_who_ex.SQL

10) How to create files, write to files, delete files from T-SQL using DOS commands?

sp_fileop.sql

11) This SP provides a detailed report on tables & indexes similar to the EM Tables & Indexes page. Provides filtering capabilities, eliminating DBCC output messages etc. Demonstrates other techniques to manipulate files from SQL Server.

sp_tisize.sql

12) This script contains the tables required for the sp_lock_ex tables. This data needs to be updated for each version of SQL Server maybe. Am working on elminating this table.

sp_lock_ex data tables.SQL

13) This SP can be used to view locking information in the system. Allows various searching capabilities that is not available in EM & this one doesn't use temporary tables.

sp_lock_ex.SQL

14) A simple example that demonstrates how to use the Script method of SQLDMO from T-SQL.

sp_scripttable.sql

15) How to the AUTOSTART SQL Server setting using SQL-DMO. This example can be extended to change any registry setting for SQL Server, SQLServerAgent, and SQLMail services.

sp_setautostartsql.sql

16) This utility SP was taken from a KB article on how to monitor blocking in SQL70. You can find the KB article here.

sp_blocker_pss.sql

17) A script to automate the transfer of standard logins from one server to another with the passwords. This one uses a distributed query against the source server.

Import Logins Using Distributed Query.sql

18) This administrative script demonstrates several powerful programming techniques. This can be used to load shipped logs & it uses the Log Shipping tables to read the parameters. The main reason that this script exists is that Log Shipping allows only restores in NORECOVERY mode only & this SP provides more options.

sp_load_shipped_logs.sql

19) Modified sp_change_user_login that corrects the working of the AUTO_FIX parameter.

sp_change_users_login - modified to correct AUTO_FIX parameter.sql

20) This adminsitrative script demonstrates some techniques to RESTORE databases & logs from timestamped files. This can be used to automate restores on a standby / development server.

sp_restore_logs.sql

21) This utility stored procedure generates several reports about the transaction log, the virtual log files that comprise the log & their sizes. This SP uses the undocumented DBCC LOGINFO to obtain the details. This SP is designed to work under SQL70/2000.

sp_loginfo.sql

22) This utility stored procedure can be used to obtain a report of the data filegroups & the transaction log. This uses the undocumented DBCC SHOWFILESTATS statement & the documented DBCC SQLPERF( LOGSPACE ) statement.

sp_filegroup_info.sql
This page was last updated on April 28, 2006 05:15 PM.