-- clean up any messes left over from before: if OBJECT_ID('AllTeams') is not null drop view AllTeams go
if OBJECT_ID('Teams') is not null drop table Teams go
-- sample table: create table Teams ( id int primary key, City varchar(20), TeamName varchar(20) )
Read more →
Everyone seems to want to "pivot" or "cross tab" data, but knowing how to do the opposite is equally important. In fact, I would argue that the skill of "unpivoting" data is more useful and more important and more relevant to a SQL programmer, since pivoting results in denormalized data, while unpivoting can transform non-normalized data into a normalized result set.
Read more →
Speaking of dates and times, there's a nice post from Ravi. S. Maniam over at the msdn blogs regarding the new and exciting Enhancements in Date and Time Data Types for SQL Server 2008.
Read more →