David Poole

Inherriting objects from an updated MODEL database

If new objects are created in the model database then these new objects only get created for new databases.Similarly, if objects are removed from user databases then getting them back into the database can be a pain.The following two stored procs copy objects from model to the current database if they do not already exist.

2003-01-10

29 reads

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

109 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,137 reads

Blogs

T-SQL Tuesday #125 – Unit testing databases – we need to do this!!

By

Welcome to the first April edition of T-SQL Tuesday. I’m honoured to be hosting...

T-SQL Tuesday Live–7 Apr 2020

By

Last week went a little crazy, and I learned something: don’t post a Zoom...

Getting Your dbatools Version–#SQLNewBlogger

By

Another post for me that is simple and hopefully serves as an example for...

Read the latest Blogs

Forums

Convert date value

By pwalter83

Hi, I have a requirement to convert a date value like '7th March 2020' ...

Partitioning table techniques which one is best way?

By Saravanan_tvr

Hello All, I am about to do partitioning for my DW tables based on...

MAXDOP and cost threshold for parallelism settings

By vsamantha35

Hi All, On one of our newly migrated sup-prod azure vm which is running...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers