Here's a quick techy post to start the New Year...
In SQL Management Studio you can save your results pane as a CSV file. All you need to do is select the grid, right-click, and select "Save Results as...". Nice and simple (and a quick way of getting your data out of the DB).
However (and there just had to be a "however", didn't there?), the CSV file that's saved can't be read by the .Net StreamReader object, as the Encoding can't be detected (it's Encoding.Unicode) automatically. Initially, I did try to detect it using the BOM (Byte Order Mark) of the file, but there isn't one. In the end, I checked that the 1st and 3rd characters were value zero, which for the files I'm interested in is perfectly valid, and if so explicitly set the Encoding to Unicode. If you do this, make sure you set detectEncodingFromByteOrderMarks to False.
Updated 2008-01-18: And now, just to annoy me (it's a conspiracy, I tell you!), the file has miraculously acquired a BOM: FF FE, which according to Wikipedia means it's UTF-16 little-endian. Not sure if the endian-ness (or whatever the term is) makes a difference, as Encoding.Unicode still works.
I've no idea where this BOM has come from - does anyone know if SQL Management Studio was updated through Windows Update recently?