Welcome to TechNet Blogs Sign in | Join | Help

Another Seasonal Query, Slightly Late..

On the heels of Christmas Eve’s seasonal query from Dirk Gubbels comes this gem from Madhivanan (with a tip of the hat to Dave Edwards’ link in Log Buffer #129).

set nocount on

select space(7-len(replicate(char(42),no)))+ replicate(char(42),no*2-1) from
(
    select top 5 row_number() over (order by name) as no from sysobjects
) as t
union all
select space(5)+replicate(char(124),3)
union all
select cast(0x4861707079204E65772059656172 as varchar(100))

This is safe to run on any database on any SQL Server 2005 or SQL Server 2008 instance.

Nice job, Madhivanan!

     -wp

Published Wednesday, January 07, 2009 11:15 PM by Ward Pond

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Another Seasonal Query, Slightly Late..

Thursday, January 08, 2009 12:48 PM by Adam Machanic

Can I play?

---

/******************************/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/**********/

---

... I hope this renders properly!

# Yet Another Holiday Query: Adam Wants to Play

Thursday, January 08, 2009 10:02 PM by Ward Pond's SQL Server blog

If this keeps up, I might need to define a tag for this stuff.. Our old friend Adam Machanic , perhaps

# Database Programming: OBJECT_NAME Take Two Parameters

Tuesday, February 03, 2009 7:48 PM by Ward Pond's SQL Server blog

This post is a cousin of sorts to last December’s post regarding the OBJECT_ID function. I learned this

# DWWTWT?: March 2-6

Saturday, March 07, 2009 2:32 AM by Ward Pond's SQL Server blog

Here’s another seasonal query for you : select datediff ( dd , '10/20/2008' , '3/3/2009' ) -----------

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker