Skip to content

Instantly share code, notes, and snippets.

@jwoschitz
jwoschitz / gist:1142462
Created August 12, 2011 16:55
Parse XML in T-SQL
DECLARE @XML XML
SET @XML ='<Facility>
<Resources>
<Resource Type="Printer">
<Item Id="3" Value="Bubbleshots Deskjet Pro" />
<Item Id="253" Value="Topware LaserPrinter 5000" />
<Item Id="7" Value="Jabberbox ClassyImage" />
<Item Id="89" Value="Photoopia Megastar Over9000" />
</Resource>
<Resource Type="Phone">
@jwoschitz
jwoschitz / gist:1129249
Created August 6, 2011 10:29
Brute force implementation / C#
class Program
{
#region Private variables
// the secret password which we will try to find via brute force
private static string password = "p123";
private static string result;
private static bool isMatched = false;
@jwoschitz
jwoschitz / gist:1127168
Created August 5, 2011 09:06
Recursion in T-SQL
/*
* Example usage
* EXEC TestRecursion 5
*
* Expected Output
* -----5 - NESTED LEVEL: 1
* ----4 - NESTED LEVEL: 2
* ---3 - NESTED LEVEL: 3
* --2 - NESTED LEVEL: 4
* -1 - NESTED LEVEL: 5