The Bit Bucket

SQL: What on earth is Halloween protection?

If you’ve worked with SQL Server (or with databases in general) for any length of time, you will have heard someone refer to “Halloween protection”.  It refers to a problem where update operations could inadvertently end up modifying a row more than once.

I saw someone who was pretty knowledgeable complaining about just this problem recently. He was using a dynamic cursor in SQL Server. The problem was that he was progressing along an index, but when a row was modified, it was relocated to a position in front of where he was processing, so it got processed again.

2019-02-01

Shortcut: Undock tabs and windows in SSMS to other screens

Like Visual Studio that it’s based upon, SQL Server Management Studio (SSMS) is very flexible when working with query windows and tabs.

Most people realize that you can undock and move tabs and windows around. Usually they do that by accident and then realize that the Reset Window Layout option in the Window menu is helpful.

But one option I’ve found that many people don’t seem to realize is that you can undock just a single query window and move it outside the bounds of SSMS. You can even place it across on another screen if you have multiple screens.

2019-01-31

SDU Tools: Script SQL Server Table

In our free SDU Tools for developers and DBAs, we’ve added a lot of scripting tools. The tool that I’m describing today is one of the most sophisticated tools in our scripting options. It’s ScriptTable.

It’s very flexible. For example, it can change the name of the table, or the schema that it’s in. It can force ANSI_NULLS and ANSI_PADDING on or off. It can change user-defined data types to their base types, change compression strategies, and more.

2019-01-30

T-SQL 101: 2 What is T-SQL?

In the first blog post of this introductory series for learning T-SQL, I talked about what SQL is. That then raises the obvious question, about what T-SQL is.

Well the promise of SQL was that we’d have one language, and it would work with all databases. Did that end up working? Well, sort of.

Committees, even the ANSI committees, are notoriously hard to make progress in. Everyone has no doubt heard the joke about a camel being a horse designed by a committee.

2019-01-28

Bring your reports and analytics to life. Learn SQL Server spatial now.

I love working with SQL Server spatial. Don’t just use boring tables and charts. Spatial data can really help to bring your reports and analytics to life.  Don’t assume spatial is just about maps. (It’s not). Don’t assume you don’t have spatial data. (I’m sure you have addresses, locations, etc.)

We’ve been working hard lately on getting many of our popular in-person courses, converted to being available online and on-demand. We’re really proud to now have SQL Server Spatial for Developers and DBAs available.

2019-01-25

Shortcut: Tab groups in SQL Server Management Studio

In a previous post, I showed how you might use split windows to allow you to work on different parts of a single query at the same time.

But what if you need to work on two queries and see parts of both of them?

That’s where tab groups can help you. You can create both vertical and horizontal groups. For me, the most useful is typically side-by-side vertically, for when I’m comparing two sections of code.

2019-01-24

SDU Tools: Script SQL Logins for SQL Server

In our free SDU Tools for developers and DBAs, we’ve added a lot of scripting tools. To script out SQL authenticated logins (as opposed to Windows logins), we have ScriptSQLLogins.

You can see how to use it in the main image above. It’s a function, that takes a list of the logins to script. You can pass the value ALL or a comma-delimited list.

Importantly, as well as the login and the hashed password, it also scripts other details:

2019-01-23

Opinion: Bad news is best delivered promptly and directly - don't BS

In the 1990’s I was running a software company. We had a great sales guy who was also a great friend. One of the things that I loved about working with him, is that even if he didn’t know how to solve a technical problem, he’d ask the questions that I led me to see a problem differently. I could then solve it. I wish every technical person was lucky enough to have someone like that.

2019-01-22

T-SQL 101: 1 What is SQL?

For some time, I’ve been thinking that I should create a series of blog posts about the T-SQL language, from a beginner’s perspective. For the next few months, my Monday posts will be intro-level T-SQL.

The obvious topic to start with then, is what is SQL in the first place?

When I started working with databases in the 1980’s, there were many, many different types of database. Each database had its own language that was used to get information back out of the database, or to put the information into the database in the first place.

2019-01-21

Business Intelligence: Success is about small starts leading to bigger things

I spend a lot of time on client sites and time and again, one of the mistakes that I see people making, is trying to start with large projects. I think one of my all time favorite quotes about IT is:

Any successful large IT system used to be a successful small IT system.

The next time you’re thinking about creating a project that’s going to have a big bang outcome, please remember this. The history of the industry is that it really is likely to be a big bang, and not in terms of being a big success like you’d hoped for.

2019-01-18