.NET Is Hard

Wednesday, August 31, 2005

DonXML and Sahil have been talking about the E-week article “DBAs Bar Door Against Big Bad .Net Wolf”. Both guys have some good insight.

One paragraph in the article struck home with me:

Much of the problem has to do with the fact that .Net is just too hard, Dobson said. "Most IT pro people—I'm talking about the DBAs—did not embrace .Net" when it first came out in 2001, he said.

True, true. Just the other day I was working with a DateTime value in C#, but what I really needed was a string with a plain ol’ U.S. formatted date. After some intense concentration, I typed the following:

string date = someDate.ToShortDateString();

I’m sure many of you have felt that pain. It’s particularly hard with Intellisense always popping up bizzare windows. I couldn’t take the foolishness anymore, so I wrote a T-SQL UDF instead, and used the following: 

SET @date = CONVERT(char,@someDate,131)

I was pretty happy with this version, but during testing I discovered I was getting strange output. It turns out the number 131 tells SQL Server to use Kuwaiti algorithm and the Islamic lunar calendar to produce a date.

Oops!

No problem - I tried 126, 108, 105, and then 6. No luck. Eventually I put in a 101 - and everything worked!! Tee-hee!

I spent the rest of the afternoon etching the T-SQL date format styles into a piece of corkboard using my trusty soldering iron. I'll hang this above my desk to make life even easier.

I won't tell you what happened when I implemented String.Split in T-SQL. I'll leave the wonderful experience as an excercise for the reader.


Comments
scott Wednesday, August 31, 2005
I have been privately informed that a DBA wants to hit me with a big stick, because I'm poking fun at T-SQL.

This article was an attempt at saying "if you can learn how to do string manipulation in T-SQL, you won't find .NET hard at all" - with some humor and sarcasm mixed in.

If you didn't get the "gist" of the article then I apologize, I have failed to write clearly...

... or perhaps I forgot to pass a 346 and a 3.14 to my PostBlog() function ...
Raymond Lewallen Wednesday, August 31, 2005
Ok, thats just funny
scott Thursday, September 1, 2005
Kent has an interesting read, too: www.sqljunkies.com/.../16581.aspx
secretGeek Monday, September 12, 2005
classic.

I had to read it through twice just to be certain of the sarcasm. fantastic stuff. you deserve a badge of sarcastic honour.
scott Tuesday, September 13, 2005
A badge I'll wear with pride.
Comments are now closed.
by K. Scott Allen K.Scott Allen
My Pluralsight Courses
The Podcast!