Tuesday, July 3, 2012
Wednesday, June 27, 2012
It turns out that if you naively (although it makes sense) try to do:
insert(2)... <-- error here
contrary to intuition, although insert(2) fails, and you would think the transaction gets aborted at this point, insert(3) still goes through. in order to rollback inserts 1 through 3, you would typically need to check for @@ERROR after each of the inserts, and do some sort of GOTO, which will let you jump to some error handling code section, which will perform ROLLBACK TRANSACTION.
Obviously this gets to be pretty, if not excruciatingly painful, to insert the check for @@ERROR after every single statement!
Thankfully there is a much cleaner way of doing this: TRY..CATCH
When dealing with lots of adhoc data and relational databases, you want to be able to generate insert/update SQL statements in excel, based on some data in the spreadsheet.
Typically you will have some template SQL statement with placeholders for data that varies from row to row. Here is one approach to accomplishing this in Excel with relative ease.
Put your SQL template in cell A1. Lets say my template looks like this:
insert into some_table (one, two) values (@some_value, '@some_string_value')The funny looking @ denote placeholder where we want to insert our variable content.
This turns out to be fairly easy to do in Excel, if you use SUBSTITUTE() function.
Just use the template above with SUBSTITUTE:
=SUBSTITUTE(SUBSTITUTE($A$1, "@some_value", B1), "@some_string_value", B2)
Tuesday, June 19, 2012
Saturday, April 14, 2012
Wednesday, November 2, 2011
Wednesday, June 1, 2011
Actually using it on one of our WPF .NET 4 project, after 2 hours of using it so far looks looks pretty solid, with pretty good tooling support in VS 2010.
One caveat, the Package Manager Console is kind of neat, but seems to be inferior to nuget.exe (especially when creating new packages).
A very solid, newer (may 2011) in depth video on use and features of nuget get is on channel 9