LessThanDot Site Logo

LessThanDot

A decade of helpful technical content

This is an archive of the posts published to LessThanDot from 2008 to 2018, over a decade of useful content. While we're no longer adding new content, we still receive a lot of visitors and wanted to make sure the content didn't disappear forever.

Database Mail maintenance in SQL Server

In yesterday’s post Setting up SQL Server Database Mail with gmail, I showed you how to setup SQL Server Database Mail to work with a gmail account, today we are going to look at doing some Database Mail maintenance. Database Mail messages and their attachments are stored in the msdb database. If you don’t periodically delete these messages then the msdb database might growe larger than expected. There are two stored procedure that you can call to delete items related to mail in the msdb database.

Read More...

Book Review: Pro SQL Server 2012 Practices – Indexing Outside the Bubble

Last year, I had the opportunity to contribute to my first book, Pro SQL Server 2012 Practices. This was a huge honor, and the list of my co-authors is remarkable. What we’ve decided to do is each take one chapter, written by someone else, and post a review. I reviewed Jason Strate’s (blog | twitter) chapter, “Indexing Outside the Bubble”. (A list of all the blog reviews can be found here.

Read More...

Setting up SQL Server Database Mail with gmail

If you want to mess around with Database Mail from your laptop and you don’t have a mail server, you can configure gmail for that purpose. It is pretty easy to setup, I will show you the screen from the wizard as well how to do it in T-SQL. I prefer T-SQL because I can run the same setup now on multiple machines Below is the whole thing in one easy to run script

Read More...

Doing UPSERTs in MongoDB

This post will explain how to do UPSERT statements in MongoDB. Before we start let’s first describe what an UPSERT statement is. An UPSERT statement will insert a row if it doesn’t exist already, if the row does exist then it will update the row. In SQL Server or Oracle you would use the MERGE statement. In MongDB, you can supply the upsert option in the argument. We will take a look at how that all works later in this post.

Read More...

Scala: The difference between val and var

This is a short Scala post to explain what the difference is between val and var. I was showing some Scala code to a co-worker this past week and he was asking what the difference was between val and var. It is quite simple: val defines a fixed value, it is a read only variable var defines a mutable variable, this variable can be modified In Java you would use final to create a variable which would be read only, this is the same as val in Scala.

Read More...

SquishIt and Nancy

Everybody’s favorite LTD blogger / Belgian tweeter Chris asked me last week how he could get SquishIt working with the Nancy web framework. I had to admit, I had no idea. But couldn’t imagine it would be that much more difficult than making it work with ASP.net MVC. So I decided to look into it. It turned out to be pretty much the same, with one extra step. I started out by installing the packages I needed from NuGet to an empty asp.

Read More...

Getting started with Execution Plans

Another document for the customer’s DBA checklist. This time we are going to look how we find and read an Execution Plan from a query. Showing an Execution Plan I will only focus on the graphical Execution Plans and in the examples the AdventureWorks2008R2 OLTP database is used which you can download here. To see a Query Execution plan, you need to create a query: SELECT * FROM Sales.vStoreWithContacts And then you click the “Display Estimated Execution Plan” or the “Include Actual Execution Plan” button in the SQL Editor Toolbar of SQL Server Management Studio.

Read More...

Review of The Well-Grounded Java Developer

This is a review of The Well-Grounded Java Developer, Vital techniques of Java 7 and polyglot programming. Written by Benjamin J. Evans and Martijn Verburg. The book was published in July, 2012 and it contains 496 pages Right from the start I want to say that this is an excellent book and I highly recommend it. One thing you do need to be aware about is that in order to use this book you need to know Java.

Read More...

Giving users the ability to change a stored procedure without making them db_owner

I once did some work for a company and noticed that they were running as sysadmin. When I asked why, their answer was that the stored procedures would not work otherwise. This is very bad practice, in general I create a user, and then give execute permissions to the procedures. In some instances the user might also get reader and writer permissions. Yesterday I got a request from a person who wanted to be able to change two stored procedures on the staging server.

Read More...

Database Projects – Installing the Database Project Template

This is the second post in the Database Projects series. The first post was Setting up Source Control. So now we have Source Control in place we need to install the Database Projects Template. To do this launch SQL Server Data Tools 2012 (SSDT). In the Start Page, choose for a New Project: When you want to create a Database Project for the first time, you’ll see a Web Install in the New Project Template screen when you select SQL Server:

Read More...