Passing an Array of Values to a Stored Procedure in SQL Server 2005
I've always dreaded handling the situation where I need to pass an array of values to a stored procedure. Yeah...there are several ways to do it, but none of them are really pleasant IMHO. I came across the following post by Jon Galloway that puts to use SQL Server 2005's XML capabilities to allow an XML fragment containing multiple values to be passed in as a single parameter and parsed. Sure, there are pros and cons to this approach, but this technique makes reaching the end goal faster and easier than some of the alternatives. Especially if you consider using the XML serialization capabilities in .NET to automatically serialize object properties to XML that is then passed to a sproc.