Scripts

Technical Article

Generate Insert Statements Easily

This script will generate insert statements for the given tables. You can pass the tables names, separated by commas, into sp_DataAsInsCommand stored procedure as in the example below: EXEC sp_DataAsInsCommand 'employee,titleauthor,pub_info' Updated on 5/25/01 to correct an issue with columns that are short like a column defined as char(1), to correct another issue with the […]

3 (9)

You rated this post out of 5. Change rating

2001-08-09

4,641 reads

Technical Article

Drop all Connections from a Database

On development servers, at times there is a need for dropping and renaming database(s). These scripts can be used for achieving these tasks. The usp_DropDB script will kill the connections to the database and then drop the database. It takes care of the space in the database name, if any and also makes sure that […]

5 (2)

You rated this post out of 5. Change rating

2001-08-08

5,442 reads

Technical Article

Kill All Users in A Given Database

This script will kill all users in a given database. Before disconnecting, it can optionally send the user a NET SEND Message giving them a warning to disconnect. To run, simply call it like usp_killusers 'dbname'. Make sure the @dbname parameter is not the master database.

4.17 (6)

You rated this post out of 5. Change rating

2001-08-08

4,468 reads

Technical Article

Quickly Enable/Disable Triggers and Constraints

When loading data, nothing can be more frustrating than having to deal with stubborn constraints and triggers. This is especially true when you know your data is fine but the constraints are too prohibitive for a mass initial load. Here's a technique I use to disable the constraints and triggers temporarily during a mass load. […]

5 (1)

You rated this post out of 5. Change rating

2001-08-08

3,048 reads

Blogs

SQL Saturday NYC Recap 2025

By

My first time at SQL Saturday New York City was an absolute blast! Thank...

SSMS 21

By

Just a quick one this morning. I’m on the road and haven’t worked up...

Why Data Silos Hurt Your Business Performance

By

Businesses rely on data for decision-making and strategy, but data silos hinder productivity. These...

Read the latest Blogs

Forums

SSPI handshake failed error code 0x80090311

By jamesstirling01

Hi, I have a workstation with SQL Express 2019 installed and I have a...

Need query help - MAX record

By jmerlau

Hello - I have attached a Word document here with details about my issue....

Need query help - MAX record

By jmerlau

I am having trouble writing linking the MAX query that I created back to...

Visit the forum

Question of the Day

Removing Log Shipping

If I want to delete a log shipping secondary server where only one database is used to restore the logs, what should I do?

See possible answers