Jeff's SQL Server Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server
posts - 155, comments - 2679, trackbacks - 64

My Links



Welcome to my weblog. My name is Jeff Smith, I am software developer in Boston, MA and I was recently named a 2009 SQL Server MVP. Check in frequently for tips, tricks, commentary and ideas on SQL Server and .NET programming.



Post Categories




November 2007 Blog Posts

Some SELECTs will never return 0 rows -- regardless of the criteria

In SQL, the general rule of thumb is that the number of rows returned from a SELECT will be zero if your criteria did not match any data. However, there is an important exception to this rule: it does not apply when asking for aggregate calculations such as SUM(), MIN() or MAX(), without any grouping. read more...

posted @ Tuesday, November 13, 2007 11:11 AM | Feedback (11) | Filed Under [ T-SQL GROUP BY ]

Splitting a single DataTable into Parent/Child DataTables for Hierarchical Processing (e.g., nested ASP.NET Repeater controls)

In ASP.NET, we often would like to output "grouped" data on our web pages, like this: Customer Product     Sales -------- ----------  ----- ABC Foundation          Product 1   $200          Product 2   $437          Product 3   $523         The XLZ Company          Product 1   $240          Product 2   $892          Product 3   $395    The easiest way to do this is with nested Repeater controls; one for the outer group (Customers, this case), and within that Repeater's ItemTemplate we'd have another Repeater control for the details (Products).  To use nested repeaters, you would return two separate result sets from SQL:  A "Customers" result set,...

posted @ Friday, November 02, 2007 12:16 PM | Feedback (0) | Filed Under [ .NET (C# / VB) ASP.NET Code Library - C# / VB.NET ]

Powered by:
Powered By Subtext Powered By ASP.NET