Maintenance and Management

Technical Article

Track Long Running Queries

  • Script

SQL2000 only.We use the attached script to schedule a SQL Agent job that sets up a Profile trace looking for long queries, and hourly imports them into a table.  This way we can historically (but with some degree of real time) look to see what queries put a load on the system.  We then allow […]

5 (1)

You rated this post out of 5. Change rating

2003-08-23

1,473 reads

Technical Article

Delete old backup files

  • Script

A stored procedure and two functions that given a path, a date and a file extension will do one of the following:-Delete all files of the supplied extension in that directory before a certain date.-Delete everything before the last full backup.I use this because disk space is tight and maintenance plans seem to delete old […]

You rated this post out of 5. Change rating

2003-08-21

713 reads

Technical Article

Get Filegrowth info from backuphistory

  • Script

This uses info in backup tables to display growth of datafiles (LDF and MDF) and actual datagrowth (backupsize)  over a period of time.  Replace parameter values with name of your database and date from when you want info displayed. Results are best viewed in grid.

5 (2)

You rated this post out of 5. Change rating

2003-08-20

397 reads

Technical Article

Script to View Server's Free HD Space

  • Script

This VBScript script lets you display the available disk space in each one of your administered DB servers.You have to call it with ONE argument: the filename of an archive that contains a list of known servers over which you have administration permissions.  If you program VBScript, you can put alarms when any drive goes […]

You rated this post out of 5. Change rating

2003-08-13

418 reads

Technical Article

Table Size Estimator

  • Script

This script will output an estimate for the space required for a given number of rows for a specified table; the estimated size is based on the data produced by the "sp_spaceused" stored procedure.The script is written as stand alone, though it also lends itself to creation as a stored procedure, and can be run […]

You rated this post out of 5. Change rating

2003-08-07

4,450 reads

Technical Article

Display Database, File, Free and Total Disk Space

  • Script

This script displays the size of each SQL Server database and database file plus the size of the next extension that will be added to each file. It also displays on each line the total and remaining free disk space for whichever disk each database file is stored on.The output is nothing fancy, and could […]

1 (1)

You rated this post out of 5. Change rating

2003-07-30

1,309 reads

Technical Article

Resize data file manually to prevent downtime

  • Script

This script will resize the data file of a passed in database name and filename by 10%. It can run in 3 modes.Resize, INFO, HELP. RESIZE is passed into parameter @Mode when we know the database name and file we wish to resize. INFO is passed in when we only know the database name and […]

You rated this post out of 5. Change rating

2003-06-19

648 reads

Blogs

A New Word: Mornden

By

mornden – n. the self-container pajama universe shared by two people on a long...

SQL Training: Black Friday Deals Up to 75% Off

By

This Black Week, don't just get a discount—get ahead! Whether you're a total newbie...

How to find free space in Azure PosgreSQL

By

I wanted to figure out how big (or approximately how big) my dump file...

Read the latest Blogs

Forums

Blob Storage automated downloads

By Brandie Tarvin

Dipping my toes into the waters of Azure and of course before I get...

Announcing SQL Server 2025

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Announcing SQL Server 2025

Running Steve's Code

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Running Steve's Code

Visit the forum

Question of the Day

Running Steve's Code

Can you run this code in any of your SQL Server 2019 databases without error?

CREATE OR ALTER PROCEDURE [dbo].[StevesAmazingProc]
AS
    
        SELECT Consumer_ID ,
               Trend_Category ,
               Bit_Trace
        FROM    NewWorldDB.dbo.MarketTrend;
    
GO

See possible answers