# Wednesday, December 24, 2008

--Thanks Guntherb for the SQL Query!

 

with FirstTable as (select top 14 row_number() over (order by name) therow from master.sys.objects)
, SecondTable as (select replicate(char(32),15) theLine)
, ThirdTable as (Select replicate(char(124),3) theOtherLine)
, ForthTable as (
select  (
select left(db_name(4),1) ) + (
select substring(db_name(2),2,1) ) + (
Select replicate(substring(db_name(1),6,1),2) ) + (
Select replace(schema_name(4),'s','') ) + (
select char(max_length * 2)  from master.sys.types where system_type_id = 36) + (
select top 1 substring(wait_type,10,2) from master.sys.dm_os_wait_stats where wait_type like 'PageIo%' ) + (
Select substring(@@version,4,1) ) + (
Select substring(object_name(55),4,2) ) + (
Select convert(char(1),(reverse(convert(char(7),name)))) from sys.configurations where configuration_id = 124 ) + (
Select left(db_name(1),3) ) theEnd
)
select case  therow
      when 11 then stuff( theLine,(datalength(theLine)/2) - 1,3,TheOtherLine)
      when 13 then upper(theEnd )
      else stuff( theLine,(datalength(theLine)/2) - (theRow/2),therow,replicate(char(42),therow)) end ' '
from firstTable
cross join SecondTable
cross join ThirdTable
cross join ForthTable
where therow%2!=0

Wednesday, December 24, 2008 6:04:42 PM (Eastern Standard Time, UTC-05:00)
Stephen, only because it's you would I run such an obscure script on my SQL Server. Thanks for the Christmas SQL (and for duping me into running a malicious script), and Happy Holidays!
Wednesday, December 24, 2008 6:05:27 PM (Eastern Standard Time, UTC-05:00)
Whoops, that comment was supposed to say "and for NOT duping me into running a malicious script." My bad! :)
Comments are closed.