Category Archives: SQL

Updating a table using a join in SQL Server (UPDATE FROM)

Yes, this is most probably trivial to everybody except me. For whatever reason, I simply don’t remember this syntax. Every time I have to do this, I Google it and usually end up on this solution. You can go there … Continue reading

Posted in Database, SQL | Tagged , , | Leave a comment

A SQL helper class that allows executing a query or running a stored procedure, with or without dynamic parameters

A while back I wrote about my extension method to copy a non-generic collection to an array. A commenter pointed out that it isn’t really necessary. Oh well… here is some code that uses it… (If you use this code, … Continue reading

Posted in Database, SQL | Tagged , | 1 Comment

I hate SQL. One way of doing a subquery in a JOIN statement

I really do. I’m writing this mostly for myself because I never remember this shit. I wrote this query  now but I know that I won’t remember how to do this in future, so here is the public note to … Continue reading

Posted in Database, SQL | Tagged | 1 Comment

How to insert multiple literals explicitly into a table, only if they don’t already exist

It might seem silly, but recently I needed to insert some values into a new table I added to a system, but only if those values didn’t already exist, and I did not know how. (Yes, it’s a new table … Continue reading

Posted in SQL | Tagged , | Leave a comment