Notes on SQL

Random articles from a puzzled DBA

This article first appeared on SQL Server Central on 30 Dec 2015. Frequently there are questions relating to transactions posted on various forums and although the questions show a basic misunderstanding of this aspect of SQL Server, sometimes the answers show some misunderstanding also. I initially started an article about nested transactions, because that is …

Continue reading

[url=http://www.cartoonbucket.com/cartoons/road-runner-teasing-wile-e-coyote/][img]http://www.cartoonbucket.com/wp-content/uploads/2015/07/Road-Runner-Teasing-Wile-E.Coyote-600x489.jpg[/img][/url]

Background When SQL Server extends data or log files it fills the newly-acquired space with zeroes, to overwrite any data that may have been there beforehand. This action takes place when a database is created, restored, files are extended or added. This can take a long time, depending upon the amount of space being initialised. …

Continue reading

For several years I have happily relied on @@IDENTITY to return the latest identity of a row when inserting data. However, I have started using the OUTPUT clause and have discovered the entertainment to be had in getting the latest identity when writing to two or more tables with what can appear to be one …

Continue reading

Recently I have had to extract user’s details from Active Directory (AD) for certain security groups. Having looked through a slew of internet resources it is obvious that the work required to do this has changed little over many years – and it looks like is was deliberately designed to make it difficult. I’d like …

Continue reading