Scripts

Technical Article

MS Word VBA to Format T-SQL Text as Rich Text

This VBA script was written for MS Word. It formats the text and sets default colors for keywords. SQL 2005's Management Studio now does this by default but the previous Query Analyzer did not offer this functionality. This is useful if you prefer to print and review code from time to time (not recommended for […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2006-01-23 (first published: )

517 reads

Technical Article

Verify that your backups are archived.

If you backup your databases to a disk file, you should make sure that these disk files are then being archived to tape. Without this, your ability to recover the database is compromised in the event of a disaster. This script will examine the "archive" flag on all of the backup files to make sure […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2006-01-22 (first published: )

332 reads

Technical Article

Delete Old backup Files

The following script deletes files in the specified folder, older than specified no of days and outputs the details to the specified file location. I use this VB script to delete some old backup files those can't be deleted with the regular maintenance plans. All you need to do is to supply the backup folder […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(2)

You rated this post out of 5. Change rating

2006-01-20 (first published: )

1,799 reads

Technical Article

Calculate upcoming business day from date (Updated)

Calculates the next business day based upon the work weeklength, number of days from the start date and a list of holiday dates kept in a table called HolidayDate.Created this script for determining the next banking day from 2 days after a request for wiring funds. Can be used for things like calculating shipping dates […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(1)

You rated this post out of 5. Change rating

2006-01-19 (first published: )

1,562 reads

Technical Article

Script Login Roles Permissions in all DBSs

Populate @list variable with account(s) to script. Save output to recreate:Login, Password,Default DB,Server Roles,DB Access,DB Roles,DB Object PermissionsDB level permissions are scripted in all databases. Can recreate a single login, or accepts comma delimted list of logins.NOTE:Stored procedures are created in Master, but are deleted

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2006-01-19 (first published: )

1,788 reads

Technical Article

Create Excel XLS from T-SQL

This is a T-SQL script that uses OLE, ADO, Jet4 ISAM, and Linked Server to create and populate an Excel Workbook (XLS) file from T-SQL query. If the Excel Worksheet exists, the query will append to the "table". The code is designed to be used by SQL Agent and to append to the step output […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2006-01-18 (first published: )

13,563 reads

Technical Article

Script ALL DTS packages on server to text files

This VB script allows you to search DTS packages for keywords, etc. It is also useful for quickly locating what server a given package is on. This is very useful for debugging. Example - you want to know the name of every DTS package the touches a certain table. The text files generated contain the […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

(10)

You rated this post out of 5. Change rating

2006-01-18 (first published: )

6,050 reads

Technical Article

SP_WHO_3 - A Very Powerful Utility for All DBAs

SP_WHO_3 is a very powerful utility for all DBAs. It displays processes connected to the system and what they are doing. It can find blocking processes, can return the Input Buffer for everything in the recordset returned, and provides immense filtering and sorting capabilities. It's designed to be extremely efficient, yet it provides many more […]

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2006-01-17 (first published: )

2,465 reads

Blogs

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...

The SUM of Nothing: #SQLNewBlogger

By

I caught this interesting item over on Pinal Dave’s blog: Eleven Interview Questions that...

Read the latest Blogs

Forums

Building a SQL Server Fleet Audit That Leadership Actually Reads

By Mayank Sethi

Comments posted to this topic are about the item Building a SQL Server Fleet...

Smart AI Agents and Data Security

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Smart AI Agents and Data...

RegEx Functions IV

By Steve Jones - SSC Editor

Comments posted to this topic are about the item RegEx Functions IV

Visit the forum

Question of the Day

RegEx Functions IV

I have this data in a table in a SQL Server 2025 database:

EmailAddressID EmailAddress
7              dylan0@ADVENTURE-WORKS.COM
8              Diane1@ADVENTURE-WORKS.COM
If I run this query, which row(s) are returned?
SELECT top 10
 *
 FROM person.EmailAddress
 WHERE REGEXP_LIKE(EmailAddress, '^D', 'i')
 AND BusinessEntityID IN (7,8)

See possible answers