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 →
Sometimes, when writing SELECTs, we come across situations in which we we need to write a join containing a condition of some sort, so that the join processed will vary for each row depending on the data.
Read more →
Lots of questions come up in the SQL Team forums about conversions between Access and T-SQL and some of the differences between the two SQL dialects. Here's a few handy things to help you out with converting your projects.
Read more →
I previously wrote about a few of the new features in SQL 2005 and how they can be used to solve some old "classic" SQL problems very easily, and I thought I'd briefly discuss a few more.
Read more →
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 – 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 →
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 →
I thought I'd take a few minutes to discuss a general situation we see quite often in the programming world, using a simple T-SQL example. Let's say we have created a stored procedure that returns Customers from a database which allows you to optionally specify a particular Region to filter by.
Read more →
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 →
Part I: Standard Date and Time Functions I've posted some variations of these before, but here they all are in 1 easy package: The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any formatting considerations at all.
Read more →
Let's go to the mailbag!
In response to this post, Chris writes: Jeff, I just got done reading your VB posts. I love those sarcastic posts you do.
Read more →
(3/25/2007 update: Fixed the incorrect parameter name the last two examples)
Parameters without Stored Procedures? Let's assume that for some reason you are not using Stored Procedures. While I can respect your choice in that regard, that doesn't mean that you cannot still use parameters when constructing your SQL statements at the client.
Read more →
I've been playing around with a handy tool for creating Word and Excel files called OfficeWriter that's pretty impressive. Basically, you use Excel or Word to create templates utilizing data markers and merge fields which allow you to databind sections of the document to a data source.
Read more →
By default, the ViewState for ASP.NET DataGrids can be quite large, as it normally stores enough information to recreate the grid completely after a postback. Often, I have found that I need the grid to display a list of items with only paging, sorting, and some buttons that let you delete or edit (via another page) individual items.
Read more →
A common difficulty beginning SQL programmers encounter is joining two or more transactional tables all in one SELECT statement. Missing data, duplicates, time-out errors, and other unexpected results often arise from trying to directly write JOINS between two transaction tables.
Read more →
So, you've decide to write a comment about how bad either VB and/or MS Access is in a programming forum! Well, you've come to the right place, I'm here to help.
Read more →
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 →
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 →
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 →
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 →