The Bit Bucket

SDU Tools: Extract Trimmed Words from T-SQL Strings

Occasionally I’ve needed to take a string, and extract all the words out of it. For example a string like ‘hello        there     greg’ might lead me to want the three words ‘hello’, ’there’, and ‘greg’. Note that I usually want them trimmed, not just extracted.

In our free SDU Tools for developers and DBAs, we added a table-valued function ExtractTrimmedWords to help with this. You can pass it a string, and it will pull it apart for you, assuming that you have whitespace separating the words.

2018-08-15

Opinion: Avoid annual subscription surprises for your customers

Yet again, a few days back, I received two invoices that showed I’d just paid (via PayPal fortunately) a pair of annual subscriptions. These are subscriptions that I thought were already cancelled, and we’d stopped using the products many months back.

The problem is that I’ve now spent quite a bit of my time, and quite a bit of the vendor’s time trying to work out how to cancel and reverse them. For days now we’ve had emails going backwards and forwards between ourselves and the 3rd party that they use for provisioning/charging.

2018-08-14

SQL: The T-SQL SIGN function and what's in a return type?

When you’ve worked with a product like SQL Server for a long time, and more importantly, are one of the odd people who’ve read a great amount of the documentation simply for interest, it feels really strange to come across a basic function that you’d never noticed before. That’s how I felt when someone mentioned the T-SQL SIGN function.

I thought, “the what function??”.

Now it works pretty much as you’d expect. It returns:

2018-08-13

Book Review: Don't Sweat the Small Stuff - Richard Carlson

I’ve been going through a number of fairly famous books or ones that have spawned their own industry. One of those was Don’t Sweat the Small Stuff and it’s all small stuff: Simple Ways to Keep the Little Things From Taking Over Your Life by Richard Carlson.

This one intrigued me as there are now so many follow up versions. There’s a “for teens”, “for men”, “at work”, etc. etc. etc. along with ancillary items like workbooks. So I presumed there must have been something to it.

2018-08-10

New online on-demand SQL Server courses from SQL Down Under

Hi Folks,

We have a whole series of online and on-demand courses coming. The first two of these are available right now.

The good news? The first one is free and the second one has a big introductory discount.

The first course 4 Steps to Faster SQL Server Applications is a short course for developers, new DBAs, and testers, etc. who don’t know anything much about tuning SQL Server applications. It focuses on finding and fixing the most problematic queries, either in terms of index tuning, or removing repetitive queries, all using free tools.

2018-08-10

Shortcut: Adding additional parameters to connections in SSMS

When I am writing my own code using a .NET (or other) language, I have a great deal of control of how the connection string that my application uses to connect to SQL Server is configured.

In particular, I might need to add another parameter or two.

As a simple example, you might have a multi-subnet Availability Group, spread across a production site and a disaster recovery site. It’s common to then have an Availability Group Listener in both subnets.

2018-08-09

SDU Tools: ExecuteOrPrint - Printing large strings in T-SQL

The PRINT statement in SQL Server’s T-SQL language is useful but one of the biggest restrictions with it is the size of the strings that it can print. Where this becomes a big issue is if you are needing to create dynamic SQL statements (which you obviously need to be careful of in the first place) or scripting database objects, and the statements need to be either executed or printed.

2018-08-08

SQL: Use elevated procedure permissions instead of elevated user permissions

Choosing the right database permission can be hard. I’ve lost count of the number of times I’ve heard a discussion like this:

I need to let Mary restore truncate one of the tables but I don’t want to give her permission to do it, in case she stuffs it up.

or

I need to let Paul restore this database but I don’t want him to be able to restore other databases, and I’m worried if I give him the permission, he might accidentally do something bad and I’ll be blamed for it.

2018-08-06

Upcoming: User Group Tour in New Zealand soon

Hi Folks, we’re looking forward to doing a number of presentations across New Zealand starting around the end of this month.

Aug 27th (Mon): SQL Server User Group - Wellington (Things I wish Developers knew about SQL Server) Details here

Aug 28th (Tue): Data Management and Analytics Meetup - Wellington (A Comprehensive Look at What’s New in SQL Server 2017 - and ongoing product directions) Details here

Aug 31st (Fri): Pre-conference Day  for SQL Saturday - Auckland (Developing SQL Server Applications that Perform) Register here

2018-08-04

Book Review: A Higher Loyalty - James Comey

I don’t tend to read all that many books on US politics but I had heard interesting things about A Higher Loyalty - Truth, Lies, and Leadership by James Comey.

I was especially interested to hear this one on Audible, given the author was also the narrator. I really wanted to hear him explain his view on the situation.

Generally, I’d avoid a book like this because I was assuming it would just be a self-apologetic or self-aggrandizing account of recent events. What I found though was very, very different.

2018-08-03