David Poole

To find the next available ID

There are times when you have a limited range of ids and these have to be re-used as they become available.The script lists the first missing id in a table.Note that this script works best for a table with a limited number of rows, say sub 100,000I tested this on a PIII 500MHz 256Mb RAM […]

2002-12-09

105 reads

Loop through records without using a cursor

I sometimes have to loop through records in a database and perform a specific action on the value that is returned. For example, In the script below I loop through the user tables in sysobjects and simply print them out. This technique is useful when dropping all indices/triggers on a particular table, or adding WITH […]

3 (2)

2001-11-25

9,126 reads

Blogs

SQL in the City Comes Back to Seattle

By

This year at the PASS Summit, Redgate is holding our SQL in the City...

Backup Techniques for SQL Server on Azure Virtual Machines

By

In the previous blog post I did a quick overview building a SQL VM...

SQLCover 0.5 - Fixes, smaller features and an exciting surprise

By

It has been a little while but I have updated SQLCover to include a...

Read the latest Blogs

Forums

User Access

By Rhys

Hi, I have an Windows 2012 R2 Server hosting a 2016 SQL Server, I...

Difference between task time and sys.dm_exec_query_stats time

By DamianC

Hello   I have a SQL task that ran through yesterday in around 23...

Exception handling for backup related errors.

By vsamantha35

Hi All, Need some help in exception handling. In below code, I want to...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers