Tuesday, January 15, 2008

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?

Coding | Work
Tuesday, January 15, 2008 1:48:35 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 

Somehow I had managed to let my hosting account expire.  However, after paying the invoice and asking nicely, those kind people at WebHost4Life restored everything...

Well, what's new?

I've got tickets for the following gigs:

2008-03-06 - Neil Young (Hammersmith Apollo)
2008-03-19 - The Feeling (Shepherds Bush Empire)
2008-05-30 - Bruce Springsteen (Emirates Stadium)
2008-06-27 - Bon Jovi (Twickenham)

...which should all be fun!  I may have a spare ticket for Neil Young - depending if PH still wants it.

I was given The Traveling Wilburys Collection for xmas - great couple of albums, especially Volume One.

V and I are off up to the parent's place this weekend - it's my Dad's birthday the week after, so we're going out for dinner.  Just for a change we're taking V's car rather than mine - it will be the longest journey the car has ever made, so should blow away a few cobwebs.

Right, that's it.  Update done.  Back to work...

Tuesday, January 15, 2008 1:36:56 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |