Monthly Archive

Comma Delimited List as Stored Procedure Parameter

May 22 2007

The crew at 4 Guys From Rolla have come through for me again (as they frequently do in matters of ASP, .NET and SQL). In building a new webservice, I wanted to be able to pass in a comma-delimited list of ID's to a SQL stored procedure. Unfortunately, there isn't a SQL datatype for something like "comma delimited list". I could have taken the "easy" way out and built the SQL query dynamically in C# instead of calling a stored procedure, but then I would have been mad at myself for breaking the rule that we agreed on that all the webservices would strictly call stored procedures. I figured I'd have to use SQL to parse a passed in string into ID's, and build the SQL query from there. However, this seemed like something someone else probably would have done in the past. I found a few techniques online but this one seemed the cleanest and best-implemented. You basically pass in a big varchar string of id's into the stored procedure and then call a SQL User Defined Function called "Split" which returns a table of the ID's which you can join to. It's simpler than it sounds...instead of having something like

SELECT *
FROM table
WHERE id in (--lots of convoluted code to parse out the ids--)

you just call

SELECT *
FROM table
WHERE id in ( SELECT convert(int,Value) FROM dbo.Split(@list_string,',') )

The complete code for the function and examples of how to use it are listed in the article. Thanks to "4 Guys" for saving me a couple hours and some headaches with this nifty technique!

Links for May 17, 2007

When Senior System Analysts Can't Find Their Way Home...

May 14 2007

In the testing phase for a recent release, I received an email from the client's third party development team stating that there was no way to return to the homepage once they clicked on any link off of it. They were having to reload the URL. No way home? How could I have missed that?!

I didn't know what to think. I had run through all of the changes myself, paying particular attention to the navigation just the day before. I immediately loaded the site and checked it out. It was fine, the corporate logo was successfully linking to the homepage on every page I tested. What could the developer have seen that I was missing... JavaScript error? Browser-specific problems?

Then it occurred to me...

In reworking the utility navigation, we had removed the explicit "Home" link. We opted instead to have the corporate logo serve as the link to the home page. We were adding a "Subscribe to Company" link and the area was already pretty full, so we decided to simplify things. It was a convention that we have employed countless times and seen employed countless others. The Utility navigation, for those who use different terms, is what we call a group of global links reserved for user actions (rather than content) grouped together in the header -- things like "Login/Logout", "Subscribe", "Contact Us".

I re-read the developer's email and suspected that I had found the problem. The developer was looking for the "Home" link, not finding it, and reporting it as a bug. I looked down at the signature in the email and saw that I was dealing with a Senior Systems Analyst.

read more...

Silverlight Buzz

May 2 2007

If you're real quiet you can hear it: the sound of everybody and their dog talking about Silverlight. It's big, exciting news, sure. It will change the face of RIA development, sure -- if only to create some more competition. But will it take over the web? I'm not so sure.

The video demos are impressive, though I fear the DRM hoops that a Microsoft backed content-delivery platform will enable. The "drop in your javascript and see exponential speed increases" claim is a strong pull as well. Plus, I like Python, and I like anything that will give me an opportunity to write in it more often, so there's that.

I'm still not drinking the kool-aid regarding managed code in general, though, so .NET in the browser on top of a mini-CLR isn't so appealing to me. Also, I cringe every time I have to open Visual Studio, so I'm really not looking for another reason to tie myself to it. There's always text editors, I guess (incidentally, your only option if you're developing on a Mac). Lack of Linux client support is the deal breaker for me, though, as I've made the transition to Ubuntu at home, and have no intention of ever installing Vista on any machine I own.

The Buzz (well, mostly TechCrunch) is declaring everything else dead. AJAX is dead:"a bicycle next to a ferrari"; Flash/Flex is dead: "an absolute toy". And everybody else really seems to be chomping at the bit to praise Silverlight and to turn it into a golden hammer for web apps.

read more...
Archives
January, 2010 (2)
November, 2009 (1)
October, 2009 (1)
January, 2009 (1)
October, 2008 (1)
July, 2008 (1)
May, 2008 (3)
April, 2008 (1)
March, 2008 (1)
February, 2008 (1)
January, 2008 (1)
November, 2007 (2)
October, 2007 (1)
September, 2007 (2)
August, 2007 (3)
July, 2007 (3)
June, 2007 (2)
May, 2007 (4)
April, 2007 (4)
March, 2007 (4)
Tags
.NET ASP award awards Banner blog Campaign CMS Design Development DryJoys Flash FootJoy Forms Hacks Information Architecture Information Archtecture Interaction Internationalization Launch logo design Microsite Microsoft MITX Nomenclature PhizzPop process qa Usability Web Standards
Contributors
Brandon (8)
Denis (4)
Denise (21)
Jon (12)