Insert? Update? Nope, it’s MERGE!

I needed to track changes when updating a table, but I wasn’t really sure what would be the most perf-friendly method. Luckily I stumbled on a great post about T-SQL MERGE. The post described almost to a “T” what I needed to do: some records would stay the same, some would drop off, and others would change.

MERGE is pretty slick. I was able to easily take the 3 queries I had in place for insert, update and delete (well, soft delete anyway) and basically cut/paste them right into the merge command. It is nice that the syntax matches up so well and makes sense (unlike things like ROW_NUMBER() – yuck). It was really a nice, concise way to get exactly what I needed, and it performs very well.

ASPState

I just had to configure a fresh server install, and I had a little basic setup. It has been a while since I did anything like this, and I don’t remember how to setup the session state DB.

To install the ASPState session state DB use the following command:

aspnet_regsql.exe -ssadd -sstype p -S {Server} -U {Username} -P {Password}