Wednesday, January 8, 2020

SQL FOR XML for string concatenation

Just a quick link to a great tip of using the FOR XML clause to concatenate values in rows into a single string (grouped by another column).

These posts go into the mechanics of the FOR XML, and some debate as to the pros and cons.

Monday, January 6, 2020

SQL Merge

I recall a few years ago that the SQL MERGE statement had some problems, and decided that I'd avoid it by just coding its constituent parts (INSERT, UPDATE, DELETE). Today I was wondering if it still had problems, and came across this scoresheet from MSSQLTips. The use cases with problems seem mostly outliers, but there are enough issues that I have trouble feeling confident about the underlying technology. For now, I'll keep coding it by hand.