Tag Archives: T-SQL

Shooting Yourself In The Foot While Testing Triggers, or The Importance of GO

No, not “Go” the game… I was working on some functionality for a create table trigger. I had the whole creation / testing thing wrapped up in a single script for easy testing and possible deployment across multiple databases: All … Continue reading

Posted in Uncategorized | Tagged , | 1 Comment

Advent of Code and BULK INSERT problems

Have I said how much I hate the new WordPress “add post” page? No? Well, I do. Particularly when editing an earlier post… Anyway. Where were we? Oh yes. Advent Of Code. For those of you who don’t know, it’s … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Testing SQL Agent Job Step Output During The Job

(This follows on from my previous script about emailing SQL Job ouput.) There are times when a SQL server scheduled task needs to look at the output from the previous step, and make decisions based on that – particularly when … Continue reading

Posted in Uncategorized | Tagged , , , | 1 Comment

Login Script Generation For Migration or DR

I needed a script to create logins on a second server to match the primary. There are reasons why using, say, the powershell dba tool set isn’t an option (eg the server isn’t built, or the two can’t communicate, or … Continue reading

Posted in Uncategorized | Tagged , , | 5 Comments

Departure of a SQL Server Administrator – What to Check?

A SQL Server administrator has left. But what does that actually mean? What do we need to check to make sure that things will continue to work after their Active Directory account is disabled? Some things to check are: SQL … Continue reading

Posted in Uncategorized | Tagged , , , , , | 1 Comment

Upgrading SQL Server using Availability Groups – Checklist

This is a checklist put together and followed for an upgrade of a pair of physical SQL Server 2012 servers which hosted a single availability group of several terabytes of data with minimal downtime. The availability group was configured with … Continue reading

Posted in Uncategorized | Tagged , , , , , , | 3 Comments

Postcode Data and the Geography of a Drunkard’s Walk in SQL Server

I was thinking about postcode data, as it might come in handy for some reporting / planning / analysis work later. There’s a set of scripts to create tables and populate with postcode data in SQL Server, which was my … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Wrapping up CPU Load Graphs into a Stored Procedure

After the fun of the last few days, I thought it might be a better idea if I wrapped this all up into a single stored procedure. So I did that. Parameters I have implemented the following parameters: @ShowCPUAsLines (BIT, … Continue reading

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

CPU Load Graphs & Deadlocks 2 – Tweaks

Following on from the earlier post CPU Load Graphs and Deadlocks Bug fix Oops. Of course, I wasn’t expecting this system to have multiple deadlocks in the same minute, but, if you do have that situation and you use the … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

CPU Load Graphs with Deadlocks

Continuing on disappearing down the rabbit hole… Send help! Or coffee! Deadlocks I’m always being asked, sometimes being asked, somebody asked me once “what about the deadlocks? Can you show them on your CPU load graphs?” Oh, go on. First, … Continue reading

Posted in Uncategorized | Tagged , , , , , | 1 Comment