Fixing SQL AG Routing "Cannot find host" using packet analysis (and a spell checker)

I was setting up an availability group listener recently and when I tried to connect to the listener I got an error message to say “The host cannot be found” after the usual 15 seconds connection delay. I checked the usual thing like TCP was enabled on the replicas and that routing was configured, but every time I tried I kept getting the “The host cannot be found” error. Now, I don’t know about you, but I find error messages like this completely infuriating especially when I knew the hostname of the listener resolved because I could ping the damn thing (and then connect straight to the IP address.

"the input device is not a TTY" error running docker on VSTS build agent

I have been playing around with including all my build dependencies in docker for windows lately and had a build that kept giving me this error in the build log: “the input device is not a TTY. If you are using mintty, try prefixing the command with ‘winpty’” The command I had been running was along the lines of: docker exec -it powershell.exe ./some/script.ps1 The problem was that I was using -it which means “interactive” and “create a virtual TTY”, to run my script I needed neither of those so took them off.

How do I use VSTS variables in YAML CI Build definitions?

Hey, VSTS YAML builds are my new favorite thing, by like a million miles. If you have a yaml build definition ( .vsts-ci.yml ) and you want to use one of the build variables then it isn’t totally clear how to include them in a definition (it hasn’t been out long so I expect more docs to come soon), while we wait for the docs if you want to use one of the variables from https://docs.

You have your database in source control now what?

This post is for a specific type of person if you are: New to source control Are getting started on your path to the continuous delivery nirvana Have been able to get your database into some sort of source control system Have more than one person checking in code to the database source You are unsure what yo do next Then this post is for you! Choosing a source control system and tools to manage your database code is a great hurdle to have got past, well done!

Running any AzureRM powershell command tells you to "Run Login-AzureRmAccount to login." even though you are logged in!

Every AzureRM command I was running I would get an error message telling me to login, I then did a login, checked that I had the right subscription and I was still getting the error message - after logging in 7 times I figured that maybe there was something else wrong :) It turns out that I had originally installed the Azure RM cmdlets via the Azure SDK and had somehow also managed to install the AzureRM.

Watching for powershell changes and running Invoke-Pester

It seems like more and more recently I have been writing powershell and typescript rather than c# and t-sql and there are quite a few things to like about the tools for both of these (typescript and powershell). One thing I really like with typescript and javascript in general is that it seems everything has a file system watcher so you can have your code ide, a couple of terminals and all your tests run etc in the background.

SSDT How To Fix Error SQL17502

TLDR: If you build an SSDT project you can get an error which says: “SQL71502: Function: [XXX].[XXX] has an unresolved reference to object [XXX].[XXX].” If the code that is failing is trying to use something in the “sys” schema or the “INFORMATION_SCHEMA” schema then you need to add a database reference to the master dacpac: Add a database reference to master: Under the project, right-click References. Select Add database reference…. Select System database.

A virtualized CPU forced me to eat my lunch early, every day, for weeks

I worked one particular contract where I was forced to take my lunch at 11:35 every day, and it was all virtualisations fault! To set the scene it was a company who wasn’t really used to having developers, they had a load of SQL analysts and some mainframe developers but SQL developers writing T-SQL, C# and SSIS code was new to them. The IT management had decided that buying actual computers wasn’t necessary for development.

Where do you install tSQLt?

The question of where to install tSQLt is probably the most common question I get when I talk about unit testing T-SQL, so much so that I thought that it would be a good topic for a blog. I mention tSQLt in the title, but this covers all unit test code for T-SQL. So to be more specific: Where do you install unit tests and unit tests frameworks for SQL Server, which databases should have that code in them?

tSQLt Test Adapter for Visual Studio 2017

So Visual Studio 2017 has been released a while and I had created a version of the test adapter (which lets you run tSQLt tests from within Visual Studio with SSDT, ReadyRoll or just plan sql scripts using the test window but I held off on pushing it to the marketplace as it didn’t work with Visual Studio 2015. I spent quite a lot of time trying to work out how to build a single vsix that worked with VS 2015 and 2017 and in the end gave up and now there are two versions, one for 2015 and one for 2017 - I am not putting any fixes into the 2015 version so I would upgrade to 2017 if you want any updates.