T-SQL, yes please!

How to (easily) move data between SQL databases

Every now and then, you will run into a situation where you need to overwrite a database’s contents with those of another database. Maybe you’ll need to update a staging environment with a partial data import from production, or perhaps you have a new developer coming in who needs some data – I don’t know. But this should be a run-of-the-mill action. Something you can do in a minute. The bottom line is – this shouldn’t be complicated. And it should be documented really well.…Continue reading How to (easily) move data between SQL databases

Microsoft SQL Server logo

How to clean up duplicates from MS SQL Database?

This article explains how to query and remove duplicate entries from a Microsoft SQL database using T-SQL. The same model works both for Azure Databases (in Azure SQL Query Editor) and databases on MS SQL Server (using SSMS – SQL Server Management Studio). I had to do this a while back due to a bug in an API creating multiple entities with the same content – save for the Identity field. Fun! Background Why bother? That’s a (somewhat) valid question. A table in a SQL…Continue reading How to clean up duplicates from MS SQL Database?

Microsoft SQL Server logo

How to connect to your local MSSQL server using SSMS?

Every now and then you run into a situation, where you really need to run some SQL against your local development database. That database, at least in my case, is hosted on your local SQL Server Express. Connecting to a local SQL Server should be a walk in a park, right? Eh, well… While using a connection string to connect to said DB is easy, you can’t do that with the SQL Server Management Studio. I wish you could, but hey – it is what…Continue reading How to connect to your local MSSQL server using SSMS?