Yet Another Holiday Query: Adam Wants to Play
If this keeps up, I might need to define a tag for this stuff..
Our old friend Adam Machanic, perhaps inspired by the work of Dirk and Madhivanan, left a comment with his own contribution to the seasonal query pool.
He was sufficiently concerned that his query wouldn’t render well in the mudpit that he also sent a copy to me via email. Much like a fine meal, presentation is definitely part of the charm of Adam’s work. Here’s his query, passed through my magical three-step source-code-formatting-for-blogs process:
/******************************/select/******************************/
/*********************/space(no//**/4)+stuff(/***********************/
/*********/replicate(char(42),/*******/((no+1)%2)+1),((no+/**********/
/****/1)%2)+1,0 ,space(3+/*************************/(1%no)+ (abs/****/
/********/(abs((no%2)-/************************/1)*sign(no-4/********/
/*************/))) - ((no/***************/-1) /2)))from/*************/
/****************/(select top 4/***/row_number()over/****************/
/***************/(order by/*****************/name) as/***************/
/************/no from sys/********************/.types)as t/**********/
As with the other queries in this series, this is safe to run in any database on any SQL Server 2005 or SQL Server 2008 instance. For best results, use text output rather than grid.
Thanks, Adam, for joining in the fun!
-wp
Comments
Anonymous
January 01, 2003
This post is a cousin of sorts to last December’s post regarding the OBJECT_ID function. I learned thisAnonymous
January 01, 2003
Here’s another seasonal query for you : select datediff ( dd , '10/20/2008' , '3/3/2009' ) -----------