The Bit Bucket

SDU Tools: Converting between Base64 and Varbinary in T-SQL

In our free SDU Tools for developers and DBAs, we have added many tools that help to convert data between different types and formats when working with T-SQL.

In some recent consulting work, I needed to convert data from BizTalk messages into other formats. To help make this easy, I added a function that converts from the Base64 (used by Biztalk messages and other applications) into varbinary.

Not surprisingly, we called it Base64ToVarbinary. And for completeness, we also added the reverse function: VarbinaryToBase64.

2018-07-05

Shortcut: Fixing or improving SQL Server Books Online

I mentioned in an earlier post that I think the online version of Books Online (BOL) is now superior to the version that you can install locally.

I particularly like the way that the online books are now cross-version ie: each page covers all supported versions, instead of having a separate page for each version.

But one of the really big bonuses is that you now have the opportunity to change the documentation if you think it’s incorrect or you think it could be improved. Microsoft have placed all the documentation in a Git repository and you can change it. Doing so is easier than you might expect.

2018-07-05

SQL: Finding rows that have changed in T-SQL - CHECKSUM, BINARY_CHECKSUM, HASHBYTES

If you have data in a SQL Server table and you want to know if any of the values in a row have changed, the best way to do that is by using the rowversion data type. (Note: this used to be called the timestamp data type in a rather unfortunate naming choice). I’ll talk more about it in another post.

But today I wanted to discuss the another issue. If I have an incoming row of data (let’s say @Parameter1, @Parameter2, @Parameter3, @Parameter4) and I want to know if the incoming values match the ones already in the table and update the table only if they are different, what’s the best way to do that/

2018-07-02

Book Review: Essentialism - Greg McKeown

Another book that I’ve been listing to lately on Audible is Greg McKeown’s Essentialism: The Disciplined Pursuit of Less.

This was a very timely book for me. I find it very easy to get endlessly bogged down in minutia, rather than just always focusing on the big picture of what I’m doing. It’s really easy to do that if you have a great desire to get things perfect or close to perfect. But that’s not what you should be aiming for.

2018-06-29

Shortcut: The magical F1 key - help on syntax and metadata

I used to always recommend that people install Books Online (BOL) on their systems. It’s ironic that it was called “Online”, given we’re really talking about “Offline” nowadays, but back when we first were talking about it, we were comparing it to a physical book, not to a live reference on the Internet.

Nowadays though, I find that the version online is so far superior to the one that you can install locally, that I think it’s better to just use the online version. I particularly like the way that the online books are now cross-version ie: each page covers all supported versions, instead of having a separate page for each version.

2018-06-28

SDU Tools: Create a linked server to Azure SQL Database from SQL Server

When I need to move small amounts of data between an on-premises SQL Server system and an Azure SQL Database, or run queries that involve both systems, the easiest option at present is to create a linked server to Azure SQL Database.

And the easiest way to do that (or if you can’t remember the commands) is with one of our free SDU Tools for developers and DBAs, called CreateLinkedServerToAzureSQLDatabase. You can read it to check out the code, or use it like this:

2018-06-27

Opinion: Learning to talk to developers - marketing to the right people for SQL Server

Yesterday, I posted about why software houses don’t keep up to date with SQL Server releases. That’s one issue but there’s also a deeper issue. When I saw postings from product group members about this, it was predominantly DBAs that they are talking to.

I think this is targeting entirely the wrong people for this discussion.

For many years now, almost all the discussion from the product group to “customers” seems to have focused on DBAs. These people are often at the end of the chain in many organizations.

2018-06-26

SQL: Why don't software vendors support the latest versions of SQL Server?

There has been quite a bit of discussion online lately about which version of SQL Server new applications should target. Members of the SQL Server product group were saying they can’t see any reason why new applications should use anything less than SQL Server 2016 as a real base line.

I’d love to see any new application using the absolute latest version of SQL Server. Unlike the bad old days where you needed to wait for a service pack before using the product, the best tested version of SQL Server is invariably the one that’s just released. (And there aren’t service packs any more anyway).

2018-06-25

Book Review: Building a Story Brand - Donald Miller

I’ve been reading and/or listening to a lot of books again lately and one that I didn’t have high expectations for, but ended up really liking was Donald Miller’s Building a Story Brand.

If you are a business owner, I’d suggest listening to it or reading it. It takes a really refreshing approach of what he calls using a story brand framework.

When you need to tell someone what your business does, how do you describe that?

2018-06-22

Shortcut: Apply cut or copy commands to blank lines when there is no selection

When I’m doing a lot of query editing, I often get a bit mesmerized, particularly if there’s a lot of manual copy and paste or cut and paste going on.

One thing that often drives me crazy is when I use Ctrl-C (ie: copy) when I meant to use Ctrl-V (ie: paste). Invariably, I do this when I have nothing highlighted at all. So not only did I not get the value pasted, I just copied an empty value into the clipboard.

2018-06-21