home articles news code blog links search  
 
         
  Code Samples

Articles and Presentations

sqldbatips.com blog



RSS feed for latest code samples


sp_SQLLitespeedmaint
Author : Jasper Smith Date : 16-05-2003
Version : SQL2000, SQL2005 Requests : 1177 hits
This procedure mimics the backup capabilities of xp_sqlmaint but uses SQL Litespeed to perform the database and log backups.Thus you get all the benefits of SQL Litespeed including faster,smaller more secure backups plus the benefits of xp_sqlmaint, standard backup naming,reporting and old backup housekeeping

sp_grantexec
Author : Jasper Smith Date : 10-02-2004
Version : SQL2000 Requests : 1315 hits
This stored procedure grants execute permissions on all stored procedures in a database to a specified user or role

sp_top_waits
Author : Jasper Smith Date : 18-07-2003
Version : SQL2000 Requests : 895 hits
This procedure uses dbcc sqlperf(waitstats) to snapshot waits over a specified period time period (in seconds) and lists the top wait types for that period

sp_diskspace
Author : Jasper Smith Date : 14-05-2003
Version : SQL2000 Requests : 1110 hits
This procedure returns the amount of free space (in MB) on all fixed disks on the SQL Server using xp_fixeddrives but builds on that by using the FileSystemObject to get the total drive space and calculate the free space percentage

sp_object_from_page
Author : Jasper Smith Date : 20-04-2004
Version : SQL2000 Requests : 303 hits
This procedure returns an object name (if available) from a database page number. Some deadlock outputs only show file and page number so this procedure allows you to find the object associated with the page

sp_perfmon_name
Author : Jasper Smith Date : 12-02-2004
Version : SQL2000 Requests : 262 hits
This procedure gets the perfmon labels for the instances of sqlservr.exe running on a server as they appear in perfmon as sqlservr#1,sqlservr#2 etc and only by coincidence will these map to the "correct"instance. The labels are decided by the order of the Process ID's

run1hourtrace
Author : Jasper Smith Date : 15-01-2004
Version : SQL2000 Requests : 355 hits
This procedure generates a server side trace file and a trace that runs for one hour as well as creating a folder based on the date and time and the supplied folder name. Can be easily configured in terms of events and filters and is a very handy way of quickly generating a trace without using Profiler

changeloginmode
Author : Jasper Smith Date : 29-07-2004
Version : SQL2000, SQL2005 Requests : 271 hits
This stored procedure changes the login mode of a SQL2000 or SQL2005 instance to Mixed or Windows depending on the parameter passed in. It wraps a call to xp_instance_regwrite that makes the required registry change. Useful for MSDE 2000 and SQL2005 Express Edition which currently has no graphical management tool.

expressmaint TSQL
Author : Jasper Smith Date : 31-07-2004
Version : SQL2005 Requests : 851 hits
Since SQL Server 2005 Express Edition does not come with the sqlmaint utility or anything like it, this code demonstrates how to write a TSQL equivalent. It allows for Full, Differential and Log backups of specific databases or all user or system databases, Index Rebuilding or Reorganization and Database Integrity checks with full reporting and old backup/report housekeeping.

fn_agentservice_DMO
Author : Jasper Smith Date : 22-08-2004
Version : SQL2000 Requests : 232 hits
This function use SQL-DMO to check whether the SQLAgent service is running on the local server

usp_serverup
Author : Jasper Smith Date : 23-08-2004
Version : SQL2000 Requests : 246 hits
This stored procedure takes the name of a remote SQL Server or a linked server defined on the local server and determines the status of it using SQL-DMO. Can be useful in log shipping scenarios or simply making sure all servers in a distributed system are available.

Most popular code
sp_grantexec
Grant execute on all procedures in a database
sp_SQLLitespeedmaint
Maintenance plan behaviour but using SQL Litespeed
sp_diskspace
Space used,free and percentage using FSO
sp_top_waits
Find the top waits over the past minute
expressmaint TSQL
Custom backups for SQL2005 Express Edition

Most popular articles
Download Reporting Services Scripter
Easily script SQL Server Reporting Services
SQL 2005 Service Manager
A SQL 2005/2008 version of the SQL Server Service Manager
Automating Database maintenance in SQL 2005 Express Edition Part II
How to automate database backups and maintenance in SQL Server Express Edition
Automating Database maintenance in SQL 2005 Express Edition Part I
How to automate database backups and maintenance in SQL 2005 Express Edition
Download Reporting Services Linked Report Generator
Easily generate Linked Reports

 
         
© Copyright sqldbatips Ltd 2008. Contact webmaster home | news | articles | code | blog | links | search  

free tracking