<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>The SQL Hammer</title><link>http://sqljunkies.com/WebLog/aegix/default.aspx</link><description>When You're A Hammer, Everything Looks Like A Nail</description><dc:language>en-US</dc:language><generator>CommunityServer 1.0 (Build: 1.0.1.50214)</generator><item><title>Go Go SQL!</title><link>http://sqljunkies.com/WebLog/aegix/archive/2004/10/20/4687.aspx</link><pubDate>Wed, 20 Oct 2004 08:53:00 GMT</pubDate><guid isPermaLink="false">d2584c15-f6ef-46f7-a2d4-24fc0e143e76:4687</guid><dc:creator>aegix</dc:creator><slash:comments>3</slash:comments><comments>http://sqljunkies.com/WebLog/aegix/comments/4687.aspx</comments><wfw:commentRss>http://sqljunkies.com/WebLog/aegix/commentrss.aspx?PostID=4687</wfw:commentRss><description>&lt;P&gt;Helped to kick off the &lt;a href="http://www.gosqlserver.com"&gt;Greater Omaha SQL Server Users Group&lt;/a&gt; &lt;i&gt;(again)&lt;/i&gt; last night.&amp;nbsp; I say &amp;#8220;again&amp;#8221; because I had also helped to formulate the ancestor of this nearly six years ago, which had finally died after nobody wanted to step forward and keep the hamsters on the treadmill fed.&amp;nbsp; Or water the ferns.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This time it'll be different.&amp;nbsp; I promise.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I've learned from my mistakes.&lt;/P&gt;
&lt;P&gt;I never wanted to hurt you, baby, but y'know, Smooth B is a busy man, right?&lt;/P&gt;
&lt;P&gt;I'm done bein a playah.&amp;nbsp; All them other user groups I been spendin time with.&amp;nbsp; The Java cats.&amp;nbsp; The Perl Mongers.&amp;nbsp; The .NET posse.&amp;nbsp; I'm done.&amp;nbsp; It's just you an' me.&amp;nbsp; Nobody else matters.&amp;nbsp; Smooth B is gonna treat you right.&amp;nbsp; You just wait and see.&lt;/P&gt;
&lt;P&gt;Anywho, I think we're quite a bit better off in terms of tie-ins with Microsoft on several levels.&amp;nbsp; This should greatly enhance our speaker credibility as well as help us with new technology gaps.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Our biggest challege will be marketing and getting warm bodies in the door for more than just the pizza and a chance at winning a koozie door prize.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Any thoughts or techniques you've used to bring people to user group meetings?&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://sqljunkies.com/WebLog/aggbug.aspx?PostID=4687" width="1" height="1"&gt;</description></item><item><title>Ok, This Has Got To Stop</title><link>http://sqljunkies.com/WebLog/aegix/archive/2004/10/08/4506.aspx</link><pubDate>Fri, 08 Oct 2004 09:48:00 GMT</pubDate><guid isPermaLink="false">d2584c15-f6ef-46f7-a2d4-24fc0e143e76:4506</guid><dc:creator>aegix</dc:creator><slash:comments>3</slash:comments><comments>http://sqljunkies.com/WebLog/aegix/comments/4506.aspx</comments><wfw:commentRss>http://sqljunkies.com/WebLog/aegix/commentrss.aspx?PostID=4506</wfw:commentRss><description>&lt;P&gt;First it was Steve, a college roommate who went to work for Microsoft just before things really took off.&amp;nbsp; You know the story:&amp;nbsp; Stock options, monster growth, vesting...yadda, yadda, yadda...then a Ferrari pulls up in my middle-class driveway with Steve at the wheel.&lt;/P&gt;
&lt;P&gt;Next, Ryan, a fraternity brother and drinking pal (I know, redundant), hooks up with a law school buddy, becomes the director of operations for a &lt;A href="http://www.paypal.com/"&gt;little company &lt;/A&gt;&amp;nbsp;then it's deja vue all over again...EBay, stock options, going public and now it's all Kobe steaks and Crystal (not really, but my envious little mind thinks that way).&lt;/P&gt;
&lt;P&gt;Now, it's &lt;A href="http://www.evhead.com/"&gt;Evan&lt;/A&gt;, a guy I hung around a bit during my interlude from college.&amp;nbsp; Becomes the&amp;nbsp;co-founder of Pyra.com, which birthed Blogger into the world, bought by Google, and now there's a healthy bank account to be reckoned with.&amp;nbsp; Like a bank account that could easily float a Lear jet or something.&lt;/P&gt;
&lt;P&gt;Don't get me wrong.&amp;nbsp; Some of it could be serendipity, but all of these guys did work for it.&amp;nbsp; I'm just torqued that I don't have the time or fungolas to take my sojourn through Nepal, swapping adventure stories with the climbers at the Everest base camp in some sort of Hemingway-inspired chapter.&lt;/P&gt;
&lt;P&gt;Whatever.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;All I want to do is be rich enough to fund a J-boat crew to ram Larry Ellison's boat during an America's Cup race.&amp;nbsp; Not that I'm an Oracle hater, I just think it would be fun.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Anyway, you need cash to do that, my friend.&amp;nbsp; Anyone have an idea for the next killer app?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://sqljunkies.com/WebLog/aggbug.aspx?PostID=4506" width="1" height="1"&gt;</description></item><item><title>ROT13 function</title><link>http://sqljunkies.com/WebLog/aegix/archive/2004/10/06/4467.aspx</link><pubDate>Wed, 06 Oct 2004 09:42:00 GMT</pubDate><guid isPermaLink="false">d2584c15-f6ef-46f7-a2d4-24fc0e143e76:4467</guid><dc:creator>aegix</dc:creator><slash:comments>6</slash:comments><comments>http://sqljunkies.com/WebLog/aegix/comments/4467.aspx</comments><wfw:commentRss>http://sqljunkies.com/WebLog/aegix/commentrss.aspx?PostID=4467</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial&gt;I've been reading Neal Stephenson's &lt;A href="http://www.amazon.com/exec/obidos/tg/detail/-/0060512806/qid=1097067981/sr=8-2/ref=pd_csp_2/102-1490908-8821755?v=glance&amp;amp;s=books&amp;amp;n=507846"&gt;Cryptonomicon &lt;/A&gt;which has been pretty cool since it uses a pen and paper cipher using a deck of cards.&amp;nbsp; An appendix from &lt;A href="http://www.counterpane.com/schneier.html"&gt;Bruce Schneier&lt;/A&gt;&amp;nbsp;discusses how he came up with the algorithm for the book.&amp;nbsp; It's explained pretty well &lt;A href="http://www.schneier.com/solitaire.html"&gt;here&lt;/A&gt;. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Since people of every have contributed algorithms in virtually every permutation of code, including &lt;A href="http://www.kx.com/"&gt;K&lt;/A&gt; (WTF? -- actually, it looks kinda cool, but don't go Torquamada on me just because I think it's a novel approach), I thought I'd have a go at it in T-SQL. Well, five hours later, I have something in the code that isn't quite right, but I wanted to get something on the blog anyway. So, my best 10 minute effort is a ROT13 encoding/decoding function. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Stop laughing. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Besides, a cursory look at Google didn't reveal anything that someone else has been done before. Hey, just because it isn't entirely practical doesn't mean that somebody shouldn't do it. Like this &lt;A href="http://www.winnetmag.com/Article/ArticleID/24139/24139.html"&gt;example&lt;/A&gt;. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Anyway, since this wouldn't be considered "real security" (whereby the oppenent knows what your using the encode your data, but doesn't have the means to decode it) and would rather be "security through obfuscation" (i.e. if your opponent knows how you encoded your data, they can break the code), this could be somewhat practical in cases where you wouldn't&lt;/FONT&gt;&lt;FONT face=Arial&gt;&amp;nbsp;want a casual look over your shoulder to reveal the data. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Maybe you have SQL authenticated passwords in a text file? We tend to change out passwords used by web applications every few months. Sure, the password file is in a secured location, but this goes a little further in helping obscure the data without being too limiting or imposing. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Whatever. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Here's the code, and in respects to the passing of one of the greatest comedians of all time yesterday: &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;V pna'g trg ab erfcrpg! &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;----------------- code below ----------- &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;CREATE FUNCTION ufn_Rot13 (@phrase varchar(8000))&lt;BR&gt;&amp;nbsp;RETURNS varchar(8000)&lt;BR&gt;AS &lt;BR&gt;BEGIN&lt;BR&gt;&amp;nbsp;DECLARE @j int, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;--// loop iterator&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;@phraseOUT varchar(8000), &amp;nbsp;--// function output&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;@letter int&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;--// ascii letter &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;--// initializing variables&lt;BR&gt;&amp;nbsp;SET @j = 1&lt;BR&gt;&amp;nbsp;SET @phraseOUT = ''&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;--// main iterator through each letter of input phrase&lt;BR&gt;&amp;nbsp;WHILE @j &amp;lt;= len(@phrase) BEGIN&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;--// pick out letter&lt;BR&gt;&amp;nbsp;&amp;nbsp;SET @letter = ASCII(SUBSTRING(@phrase, @j, 1))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;-- // rotate letter 13 places in either upper or lower case ascii range and add to output variable&lt;BR&gt;&amp;nbsp;&amp;nbsp;SELECT @phraseOUT = @phraseOUT + CASE &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHEN @letter BETWEEN 97 AND 122 THEN CASE &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHEN @letter - 13 &amp;lt; 97 THEN char((@letter - 13) + 122 - 96)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ELSE char(@letter - 13) END&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHEN @letter BETWEEN 65 AND 90 THEN CASE &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHEN @letter - 13 &amp;lt; 65 THEN char((@letter - 13) + 90 - 64)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ELSE char(@letter - 13) END&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ELSE CHAR(@letter)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;END&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;SET @j = @j + 1&lt;BR&gt;&amp;nbsp;END &lt;BR&gt;&amp;nbsp;RETURN @phraseOUT&lt;BR&gt;END &lt;BR&gt;&amp;nbsp;&lt;BR&gt;go&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://sqljunkies.com/WebLog/aggbug.aspx?PostID=4467" width="1" height="1"&gt;</description></item><item><title>Password Generator</title><link>http://sqljunkies.com/WebLog/aegix/archive/2004/09/23/4326.aspx</link><pubDate>Thu, 23 Sep 2004 16:35:00 GMT</pubDate><guid isPermaLink="false">d2584c15-f6ef-46f7-a2d4-24fc0e143e76:4326</guid><dc:creator>aegix</dc:creator><slash:comments>4</slash:comments><comments>http://sqljunkies.com/WebLog/aegix/comments/4326.aspx</comments><wfw:commentRss>http://sqljunkies.com/WebLog/aegix/commentrss.aspx?PostID=4326</wfw:commentRss><description>&lt;P&gt;For some reason, I've always had a hard time being creative on the spot, especially when needing to create a hardened password.&amp;nbsp; It's kinda like going up to a comedian and asking them to say something funny.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Sure, I could bounce my stress-relief ball on the keyboard a few times to get something of a random set of characters, but here's my coded example.&lt;/P&gt;
&lt;P&gt;CREATE proc sp__PassGen &lt;BR&gt;&amp;nbsp;@Length int, @pass varchar(15) output&lt;BR&gt;AS&lt;BR&gt;set nocount on&lt;BR&gt;declare @CapBeg int,&lt;BR&gt;&amp;nbsp;&amp;nbsp;@SmallBeg int,&lt;BR&gt;&amp;nbsp;&amp;nbsp;@i int, &lt;BR&gt;&amp;nbsp;&amp;nbsp;@cnt int,&lt;BR&gt;&amp;nbsp;&amp;nbsp;@type int,&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;@bit char(1)&lt;/P&gt;
&lt;P&gt;set @CapBeg = 65&lt;BR&gt;set @SmallBeg = 97&lt;/P&gt;
&lt;P&gt;Set @cnt = 26&lt;/P&gt;
&lt;P&gt;declare @t Table&amp;nbsp; (&lt;BR&gt;&amp;nbsp;RowNum int identity(1,1), &lt;BR&gt;&amp;nbsp;Letter char(1)&lt;BR&gt;)&lt;/P&gt;
&lt;P&gt;Set @i=1&lt;BR&gt;While @i&amp;lt;&lt;A href="mailto:=@cnt"&gt;=@cnt&lt;/A&gt; Begin&lt;BR&gt;&amp;nbsp;Insert Into @t (Letter) Values (char(@CapBeg))&lt;BR&gt;&amp;nbsp;Set @i=@i+1&lt;BR&gt;&amp;nbsp;Set @CapBeg = @CapBeg + 1&lt;BR&gt;End&lt;/P&gt;
&lt;P&gt;Set @i=1&lt;BR&gt;While @i&amp;lt;&lt;A href="mailto:=@cnt"&gt;=@cnt&lt;/A&gt; Begin&lt;BR&gt;&amp;nbsp;Insert Into @t (Letter) Values (char(@SmallBeg))&lt;BR&gt;&amp;nbsp;Set @i=@i+1&lt;BR&gt;&amp;nbsp;Set @SmallBeg = @SmallBeg + 1&lt;BR&gt;End&lt;/P&gt;
&lt;P&gt;set @i = 1&lt;/P&gt;
&lt;P&gt;while @i &amp;lt;= @Length begin&lt;BR&gt;&amp;nbsp;if @i = 1 &lt;BR&gt;&amp;nbsp;&amp;nbsp;select @bit = letter from @t where RowNum = convert(int, rand()*52)&lt;BR&gt;&amp;nbsp;else begin&lt;BR&gt;&amp;nbsp;&amp;nbsp;set @type = rand()*2&lt;BR&gt;&amp;nbsp;&amp;nbsp;if @type = 1 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;select @bit = letter from @t where RowNum = convert(int, rand()*52)&lt;BR&gt;&amp;nbsp;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;select @bit = convert(varchar, convert(int, rand()*9+1))&lt;BR&gt;&amp;nbsp;end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;if @i = 1&lt;BR&gt;&amp;nbsp;&amp;nbsp;select @pass = @bit&lt;BR&gt;&amp;nbsp;else&lt;BR&gt;&amp;nbsp;&amp;nbsp;select @pass = @pass + @bit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;set @i = @i + 1&lt;BR&gt;end&lt;BR&gt;go&lt;/P&gt;
&lt;P&gt;Without question, there's some kludginess that could be cleaned up.&amp;nbsp; I've used this extensively in environments where SQL authenticated logins have to have their passwords changed routinely (and then have written carefully-worded emails to the Powers That Be as to why we can't rely more on Windows users or groups) or when replacing entire servers.&amp;nbsp; Here's the server password changeout:&lt;/P&gt;
&lt;P&gt;declare @p varchar(15)&lt;/P&gt;
&lt;P&gt;declare @login varchar(128)&lt;BR&gt;set @login = (select min(name) from syslogins where name &amp;lt;&amp;gt; 'sa' and isntname = 0)&lt;BR&gt;while @login is not null begin&lt;BR&gt;&amp;nbsp;exec sp__PassGen 6, @pass = @p output&lt;BR&gt;&amp;nbsp;print @login+','+@p+','+@@servername&lt;BR&gt;&amp;nbsp;exec sp_password null, @p, @login&lt;BR&gt;&amp;nbsp;set @login = (select min(name) from syslogins where name &amp;lt;&amp;gt; 'sa' and isntname = 0 and name &amp;gt; @login)&lt;BR&gt;end&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://sqljunkies.com/WebLog/aggbug.aspx?PostID=4326" width="1" height="1"&gt;</description></item><item><title>On Not Listening To Experts</title><link>http://sqljunkies.com/WebLog/aegix/archive/2004/09/22/4302.aspx</link><pubDate>Wed, 22 Sep 2004 08:25:00 GMT</pubDate><guid isPermaLink="false">d2584c15-f6ef-46f7-a2d4-24fc0e143e76:4302</guid><dc:creator>aegix</dc:creator><slash:comments>4</slash:comments><comments>http://sqljunkies.com/WebLog/aegix/comments/4302.aspx</comments><wfw:commentRss>http://sqljunkies.com/WebLog/aegix/commentrss.aspx?PostID=4302</wfw:commentRss><description>&lt;P&gt;I had an interesting situation the other day.&amp;nbsp; I happened to bump in to my high school counselor.&amp;nbsp; Seems she has given up the righteous path of helping to shape kids' futures by hocking prosthetic shoe inserts&amp;nbsp;out of a 6' x 8'&amp;nbsp;mall kiosk.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;We talked up the basic pleasantries, each of us feeding the other what we knew about the current whereabouts of various classmates of mine.&lt;/P&gt;
&lt;P&gt;It seems as though an inordinate number of my&amp;nbsp;former friends&amp;nbsp;are in prison.&lt;/P&gt;
&lt;P&gt;&amp;#8220;I wanted to tell you, Luke.&amp;nbsp;&amp;nbsp;A couple of years ago when the state was investigating me...&lt;EM&gt;again&lt;/EM&gt;...[big sigh.&amp;nbsp; eyes rolling] that I came across some old aptitiude scores, and yours was one of them.&amp;#8221;&lt;/P&gt;
&lt;P&gt;A bile-infused twinge of pain hit me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;#8220;...and I discovered your aptitude was actually much, much lower than I had originally reported to you.&amp;nbsp; I just thought you ought to know.&amp;#8221;&lt;/P&gt;
&lt;P&gt;Wow.&amp;nbsp; Years of therapy (and thousands of dollars) fighting the ego eroding guilt of being a perinnual &lt;EM&gt;under-achiever&lt;/EM&gt; that I come to find out I've been an Uber-Achiver...worthy of a whole slew of gold stars and happy faces.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The lesson learned?&amp;nbsp; Even if it's an aptitude test, don't look off of someone else's answer sheet, even if the guy looks like he might be a geek.&amp;nbsp; &lt;/P&gt;&lt;img src="http://sqljunkies.com/WebLog/aggbug.aspx?PostID=4302" width="1" height="1"&gt;</description></item></channel></rss>