Jeff Smith Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server

Unique Passwords?

Today's article at WorseThanFailure.com is one that the SQL Server community might find enjoyable.  I may try to implement something similar in my next project …. or, maybe not! Read more →

SQL Server 2005: Using PARTITION and RANK in your criteria

The RANK and PARTITION features in 2005 are simply amazing. They make so many "classic" SQL problems very easy to solve. For example, consider the following table: create table Batting(Player varchar(10), Year int, Team varchar(10), HomeRuns int, primary key(Player,Year))insert into Battingselect 'A',2001,'Red Sox',13 union allselect 'A',2002,'Red Sox',23 union allselect 'A',2003,'Red Sox',19 union allselect 'A',2004,'Red Sox',14 union allselect 'A',2005,'Red Sox',11 union allselect 'B',2001,'Yankees',42 union allselect 'B',2002,'Yankees',39 union allselect 'B',2003,'Yankees',42 union allselect 'B',2004,'Yankees',29 union allselect 'C',2002,'Yankees',2 union allselect 'C',2003,'Yankees',3 union allselect 'C',2004,'Red Sox',6 union allselect 'C',2005,'Red Sox',9 Suppose we would like to find out which year each player hit their most home runs, and which team they played for. Read more →

Dear DBA ….

Dear DBA – Thanks so much for helping us developers out with the latest changes you've made to the stored procedures in our system. While it may have been nice if we got together first to discuss these changes, I do appreciate that you worked very hard to make things much easier for us. Read more →

ASP.NET 1.1 – Appsettings in Web.config

It's great to be able to put settings in the Web.Config file for my ASP.NET projects. The problem for me, though, is that when I use System.Configuration.ConfigurationSettings.AppSettings(name) to return a setting that doesn't exist in the file, an empty string ("") is returned, when ideally I would like an exception to let me know that something is missing or mispelled in my config file (or application code). Read more →

Simple T-SQL Proper Case User-Defined Function

I posted this one a long time ago and needed to use it today, so I thought I'd post it up here as well in case anyone finds it useful. This simply attempts to capitalize the first letter of each word for the string passed in. Read more →

Lots of great SQL Server 2005 Express Downloads

Have you visited the SQL Server 2005 Express Downloads page lately? http://msdn.microsoft.com/vstudio/express/sql/download/ there are so many great tools that you can download, including Reporting Services and a “Business Intelligence Studio” for designing reports, which really surprised me (since you never could use Reporting Services with the previous free versions of SQL). Read more →

Vulnerable to SQL Injection?

One of the things that troubles me most about SQL Injection is that is seems it is still very misunderstood. Is the following psuedo-code vulnerable to SQL Injection? String SearchTerm = {some user input here, unvalidated and unscrubbed -- uh oh ! Read more →

Another SQL Suduko Solver

There's been quite a few posts out there with SQL implementations of Suduko puzzle solvers: This one is a T-SQL solver, but it really doesn't do any set-based operations and doesn't really make use of SQL that much. Read more →

Programming is a funny thing ….

In most industries, beginners work on simple, short projects, using only the most basic concepts that they have learned. The experts in those industries, meanwhile, work on things that are very large, complicated, difficult to manage, and require lots of time, energy and resources. Read more →