Most Valuable Yak (Rob Volk) Blog

…and other neat SQL Server tricks

SyFy Channel Original Movie Title Generator

Saw this linked on reddit today and couldn't resist going through all the combinations:

create table #pre(name varchar(20))
create table #post(name varchar(20), pre varchar(10))

insert #pre select 'Dino' union all select
'Alien' union all select
'Shark' union all select
'Raptor' union all select
'Tractor' union all select
'Arachno' union all select
'Cyber' union all select
'Robo' union all select
'Choco' union all select
'Chupa' union all select
'Grizzly' union all select
'Mega' union all select
'Were' union all select
'Sabre' union all select
'Man'
insert #post select 'dactyl','a' union all select
'pus','to' union all select
'conda','a' union all select
'droid',null union all select
'dile','o' union all select
'bear',null union all select
'vampire',null union all select
'squito',null union all select
'saurus','a' union all select
'wolf',null union all select
'ghost',null union all select
'viper',null union all select
'cabra','a' union all select
'yeti',null union all select
'shark',null
select a.name +
case when right(a.name,1) not like '[aeiouy]' and b.pre is not null then b.pre else '' end +
b.name
from #pre a cross join #post b
where a.name<>b.name -- optional, to eliminate the "SharkShark" option
order by 1

Which one is your favorite?  I like most of the -squito versions, especially Chupasquito and Grizzlysquito.

Legacy Comments


Robert L Davis
2010-05-26
re: SyFy Channel Original Movie Title Generator
I'm only ever going to need to name 1 movie, so I changed the select query to just output 1 name at random (sort of).

select Top 1 a.name +case when right(a.name,1) not like '[aeiouy]' and b.pre is not null then b.pre else '' end +b.name
from #pre a
cross join #post b
where a.name<>b.name
-- optional, to eliminate the "SharkShark" option
order by NEWID()

Chuckarama
2010-05-27
re: SyFy Channel Original Movie Title Generator
like '%yeti'