Jeff's SQL Server Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server
posts - 157, comments - 2686, 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




May 2008 Blog Posts

Log Buffer #98

Hello and welcome to the 98th edition of Log Buffer. My name is Jeff Smith and I will hosting this week's exciting episode. If, for some reason, you are not completely satisfied with this edition, simply write in and complain to Dave over at The Pythian Group and you will receive Log Buffer #99 absolutely free! Now that is a guarantee you can feel good about. OK, let's get to work. I have only limited exposure to both PostgreSQL and MySQL, but I have often wondered why MySQL is so popular while...

posted @ Friday, May 23, 2008 9:09 AM | Feedback (10) | Filed Under [ Miscellaneous Links ]

Implementing "Interfaces" in SQL

My latest article has just been published over at SQLTeam:     Implementing Table Interfaces When I wrote a Table Inheritance article a few months back, the technique shown was pretty standard and straight-forward.  As I was writing it, I thought it would be an interesting challenge to figure out a way to implement table interfaces as well, where different tables don't inherit from the same base class, but they still "implement" the same relations.  That definitely was not as easy, and the end result isn't as clean and direct, but I hope this at least provides some ideas and at the very...

posted @ Monday, May 19, 2008 9:06 AM | Feedback (0) |

Need an Answer? Actually, No ... You Need a Question

Welcome! The reason you were directed here is because you need assistance, and I am here to help.  I am not, however, here to provide you with any answers!  You see, it looks like the assistance you need is not finding an answer; it is rather that you need assistance finding a question. As you know, there are all kinds of questions.  Questions that test memory recall.  Questions that test logic skills.  Brain-teasers and mathematical questions and so on.  But there is one requirement that all good questions must have in common before they can be answered: A proper question MUST provide ALL...

posted @ Tuesday, May 13, 2008 11:04 AM | Feedback (22) | Filed Under [ Miscellaneous ]


Here's an obscure piece of SQL you may not be aware of:  The "ALL" option when using a GROUP BY. Consider the following table: Create table Sales (     SaleID int identity not null primary key,     CustomerID int,     ProductID int,     SaleDate datetime,     Qty int,     Amount money ) insert into Sales (CustomerID, ProductID, SaleDate, Qty, Amount) select 1,1,'2008-01-01',12,400 union all select 1,2,'2008-02-25',6,2300 union all select 1,1,'2008-03-02',23,610 union all select 2,4,'2008-01-04',1,75 union all select 2,2,'2008-02-18',52,5200 union all select 3,2,'2008-03-09',99,2300 union all select 3,1,'2008-04-19',3,4890 union all select 3,1,'2008-04-21',74,2840 SaleID      CustomerID  ProductID   SaleDate                Qty         Amount ----------- ----------- ----------- ----------------------- ----------- --------------------- 9           1           1           2008-01-01 00:00:00.000 12          400.00 10          1           2           2008-02-25 00:00:00.000 6           2300.00 11          1           1           2008-03-02 00:00:00.000 23          610.00 12          2          ...

posted @ Monday, May 05, 2008 12:25 PM | Feedback (5) | Filed Under [ T-SQL GROUP BY ]

Powered by:
Powered By Subtext Powered By ASP.NET