Scripts

Technical Article

Get back list of failed dts packages

This is a fairly basic script that gets back a list of steps within dts packages that failed within the last 24 hours. The reason I wrote this script, is that if you call a dts package from a dts package on another server via a scheduled job on that same server, both the package […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2004-09-13 (first published: )

151 reads

Technical Article

Script to show user indexes tables(Sql 2000)

This script is supported only in SQL SERVER 2000, This shows only indexes created by users in tables.Parameter @tabela--> You can put the table name and get the information about users indexes in this table.OrYou can put nothing (NULL) and see all tables on the schema and how many indexes each table have.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2004-09-10 (first published: )

259 reads

Technical Article

Script to automatically restore needed log-backups

Given a backupfile with a lot of sequential log-backups, this script automatically restores just those backups out of the file, which are necessary to bring the database up to a given timelag relating to the original database.Params are path to backupfile, name of the db to restore to, timelag in minutes.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2004-09-08 (first published: )

1,666 reads

Technical Article

yet another backup script usp_backup

I wrote this to backup to a network share you can set the backup to spool to the local disk first then it will move it to another drive or to a unc just fine. Directory to hold and move to are not optional but if you set them to the same path it won't […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2004-09-06 (first published: )

412 reads

Technical Article

Script to transfer logins to second server

Modification of DR_Script_Logins.sql by Bruce Canady.Puts out a script to add new logins or change the password of existing logins.I insert the output into a table in my production-db.   insert database.dbo.login_table exec master.dbo.dr_script_loginsThat way its backed up with the data, and the logins can be restored anywhere by the script i added at the […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2004-09-03 (first published: )

2,558 reads

Technical Article

Create an audit trigger on a table

Sometimes you need an audit trigger on a table. I have created a generic trigger that will work for (almost)every table. if the audit table is not there yet, It will copy the table structure (but strip identity attributes) and put all the data in an AUDIT_ table.I believe this will work for almost every […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(5)

You rated this post out of 5. Change rating

2004-09-02

1,632 reads

Technical Article

alert on blocking chains via email

This is a script I use to watch for blocking chains on a server there are four variables to be set. @Duration tells it how long to run. This will be an active thread for the duration. @IntervalSec how often to poll for blocking. @maxwaittime time in miliseconds a thread that is blocked that you […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2004-09-01 (first published: )

1,820 reads

Technical Article

Search for text in procedures and show context

This script will search for text within stored procedures and udf's. As a bonus, it will also diplay a user-configurable number of lines from each stored proc to show the search text "in context" so you can tell if it is something you need to deal with without having to open every proc manually.

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2004-08-30 (first published: )

263 reads

Blogs

Announcements from the Microsoft Fabric Community Conference — Barcelona 2026

By

Microsoft shared a broad set of Fabric, Power BI, and SQL updates at FabCon...

Au Revoir for now

By

No, I’m not quitting or retiring. Just going on vacation, but I leave tonight...

Goodbye, Microsoft

By

A few years ago I took a new job at Microsoft, working as a...

Read the latest Blogs

Forums

Let's Talk Certifications

By Grant Fritchey

Comments posted to this topic are about the item Let's Talk Certifications, which is...

The Hidden Security Risks of Role Combination in SSAS Tabular

By Pablo Echeverria

Comments posted to this topic are about the item The Hidden Security Risks of...

The Empty Aggregate

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Empty Aggregate

Visit the forum

Question of the Day

The Empty Aggregate

I have this table in a SQL Server 2025 database:

CREATE TABLE [dbo].[CustomerOrder]
(
[OrderID] [int] NULL,
[CustomerID] [int] NULL,
[total] [money] NULL
) ON [PRIMARY]
GO
What is returned from this code? (answers are for the sum and then the count)
SELECT SUM(total) AS sum,
       COUNT(total) AS count
FROM dbo.CustomerOrder;



See possible answers