Showing all posts tagged: 'SQL Server'

A 6-post collection

Query Profiling on Azure SQL

[Azure SQL](https://azure.microsoft.com/en-us/services/sql-database/?v=16.50" target="_blank) is one of the most valuable Platform as a Service (PaaS) offerings on Azure, second only to Web Apps. It's incredibly cost effective and fully featured. It supports a number of database versions and can be deployed in seconds. The other day I was looking to test something with EF Core and I needed a database to run queries against. I went to the Azure portal, I created a database with prepopulated data using the AdventureWorks (Datawarehouse Workload - DW) and I was ready …[read more]


Solve "A network related..." connection error for SQL2000

What? Did I read this right? Did he say SQL2000? Well, my friends, you're absolutely right. I jumped into a wormhole back to 2001, did some work and jumped back to the present time. Unfortunately, it's nothing as glamorous as that. Instead, I recently moved to a new project where we're migrating an old/legacy application to a new MVC/Angular implementation. The only thing that's not moving is the SQL server. And this brings me to the reason why I'm writing this blog post. On my dev box I had SQL2014 running without any problems for months. 2 different …[read more]


Execute SQL Query with PowerShell

Scripting is very powerful. And for me, one of the best scripting languages is PowerShell (PoSH). Yes, PoSH takes a bit of getting used to, but once you pass the initial learning curve, you end up with a powerful tool in your hands. One thing that I love about PoSH is a little secret that not many people know: PowerShell allows you to import .NET namespaces and libraries and, in effect, you can write C# code to solve any problem you may have. The PowerShell's libraries, cmd-lets are very comprehensive but you can always come against something not "natively& …[read more]



Fixing error: "Cannot generate SSPI context" after changing SQL service account

Everyone knows that it is good practice to use a domain or service account to run the SQL service. I’m sure you do too! However, once you do the right thing and change the SQL Service account, you may start getting the following error message when attempting to connect to the sql server: “The target principal name is incorrect.  Cannot generate SSPI context.” The explanation, as given by Microsoft in this KB article If you run the SQL Server service under the LocalSystem account, the SPN is automatically registered and Kerberos authentication interacts successfully with the computer that is …[read more]


NLog with SQL Server and MVC 4

NLog is a great open-source logging tool that allows developers to easily and efficiently implement custom logging. Nlog can be configured to log to a number of targets, but on this tutorial we will be looking at logging to the database. First you need to add NLog to your MVC website. Bring up the Nuget package manager and search for NLog. Add the following packages: NLog NLog Schema for Intellisense NLog configuration NLog for Extended Profile This will add the necessary dlls and config files for use later. Once the installation is complete, you should see the following file at …[read more]