Programming

5 DbUp Tips from Paul Stovell

Posted on

I tuned into the Octopus Deploy and Clear Measure live stream on safe, automated, and drama-free database deployments and there was a flurry of really useful DbUp tips from Paul Stovell that I wanted to share. Use a Sequential Naming Scheme Use a numbered naming scheme to ensure scripts are sequential on the file system. […]

Programming

Find SQL Server Job Clashes

Posted on

If you are working on an older application that has a lot of logic inside of the SQL database in jobs, procedures, and functions – you may find that your job schedules cause a repeating wave of SQL compilation peaks. If you suspect jobs may be the cause, you can use a query to find […]

Programming

Who Deleted Rows from SQL Server

Posted on

Want to know who deleted rows from your SQL database? The script below joins up delete transactions with users in order to find out who just deleted something. Because this comes from the transaction log, you’ll only find stuff that is still available in there. This means it will be affected by retention/recovery modes. If […]

Programming

SQL Availability Groups: Find the Primary Server

Posted on

Here is a quick SQL script that will get back information on SQL availability groups, including the role of each server. This can help you find the primary server in an availability group. IF SERVERPROPERTY (‘IsHadrEnabled’) = 1 BEGIN SELECT AvailabilityGroup.name AS AvailabilityGroupName, ReplicaClusterStates.replica_server_name as ServerName, ReplicaStates.role_desc as ReplicaRole, Listeners.dns_name as DnsName FROM sys.availability_groups_cluster AS […]

Programming

SQL Server: Quickly Find Row Counts and Table Size

Posted on

I have a script I use to find table sizes in SQL server. Sometimes, though, I need to find the rough table size of a massive table without the need for absolute precision. SQL server has a procedure for finding out the number of rows, space, and index size of a table; and it can […]

Programming

SQL Bulk Update in Batches

Posted on

When you perform a SQL bulk update, you can just press go and wait. Most humans, though, get an increasing feeling of impending doom when the clock ticks up towards several hours with no visible progress. If you are running a transaction and have other things competing for the table, you’ll start hearing about slow […]