Scripts

Technical Article

Alert Procedure for Long-Running Job

For jobs that run periodically and should take only a short time to run, a DBA may want to know when the job has been running for an excessive time. In this case, just checking to see IF the job is running won't do; the ability to make sure that it hasn't been running for […]

4.8 (5)

You rated this post out of 5. Change rating

2002-01-15

3,971 reads

Technical Article

Show Blocking and Wait time

When executed against a database in which blocking occur, below script will report lockType, Object waited for and current Wait times. The script requires access to master..systables. The script queries syslockInfo (as does sp_lock), but further joins sysprocesses with an interpretation of waitresource matching SQL Server 7.0 and SQL Server 2000.

You rated this post out of 5. Change rating

2002-01-14

2,567 reads

Technical Article

Perform an action when a file exisits

Script to check whether a file exists with todays date and performs an action based on whether the file exisits or not. We use this to check whether backups have completed from another SQL Srver and if they have completed we restoe on a server used for management information

You rated this post out of 5. Change rating

2002-01-09

2,050 reads

Technical Article

Script to generate BCP Statements for a Database

The Script below creates a Stored Procedure that returns a Macro SQL Statement. When this SQL statement is executed, it inturn returns BCP Out Statements for all the tables in a given database. The database name should be passed as a parameter to the procedure. Before the procedure is created, the SA Password must be […]

1 (1)

You rated this post out of 5. Change rating

2002-01-07

3,834 reads

Technical Article

Report Locking on Specific Database

This Script reports locking on a particular database either to the console or to a database table. It also allows filtering based on a minimum locking level (say Page or Table and higher). Included is the CREATE TABLE statement to build the reporting table. This table can reside in any database but needs to be […]

You rated this post out of 5. Change rating

2002-01-06

1,009 reads

Blogs

Redgate Summit Comes to the Windy City

By

I love Chicago. I went to visit three times in 2023: a Redgate event,...

Non-Functional Requirements

By

I have found that non-functional requirements (NFRs) can be hard to define for a...

Techorama 2024 – Slides

By

You can find the slidedeck for my Techorama session “Microsoft Fabric for Dummies” on...

Read the latest Blogs

Forums

Always on Availability groups cluster question

By GreatPancake

Hello, I have a question regarding Availability group server architecture. A little background: We...

AG listener cant be removed

By ysalem

Testing with AG on Linux with Cluster=NONE. it was all going ok and as...

Remove comma inside Comma Delimited File csv in SSIS Using Script task

By hongho2

Hi, I have two tables: one for headers with 9 fields and another for...

Visit the forum

Question of the Day

The "ORDER BY" clause behavior

Let’s consider the following script that can be executed without any error on both SQL Sever and PostgreSQL. We define the table t1 in which we insert three records:

create table t1 (id int primary key, city varchar(50));

insert into t1 values (1, 'Rome'), (2, 'New York'), (3, NULL);
If we execute the following query, how will the records be sorted in both environments?
select city

from t1

order by city;

See possible answers